 
 MATH_MARKER_BLOCK  = '\u200c\u200c\u200c' # zero-width non-joiner
 MATH_MARKER_INLINE = '\u200b\u200b\u200b' # zero-width space
+
+MATH_SELECTOR = '[data-math]:not(.math-rendered)'
 
 cleanMathArtifacts = ->
   # Once MathJax finishes processing, cleanup the MathJax message nodes to prevent

  # submit all nodes at once for optimal rendering performance
  window.MathJax.Hub.Queue(['Typeset', MathJax.Hub, _.toArray(nodes)])

  # render MathML with MathJax
  window.MathJax.Hub.Queue(['Typeset', MathJax.Hub, root]) if hasMath

  cleanMathArtifacts()


# The following should be called once and configures MathJax.

  ])



# Typesets the entire document
TypesetDocument = ->

  nodes = document.querySelectorAll(MATH_SELECTOR)
  return if _.isEmpty(nodes)

  for node in nodes
    formula = node.getAttribute('data-math')
