Search code examples
javascripthtmlmathjax

Is there any way to exclude MathJax processing from certain HTML elements?


Is there any way to exclude MathJax processing from certain HTML elements?

If for example I know that there is not any math in a <div>, is there a way to mark it so that the MathJax processor skips that <div>?


Solution

  • Both MathJax's TeX and AsciiMath input pre-processors offer a configuration option ignoreClass to ignore elements by class name, see e.g., the tex2jax documentation. The MathML pre-processor does not have such an option, cf. this feature request.

    Still, except in cases where the DOM is very large (and the occurrence of math is very localized), the pre-processing is not a significant performance bottleneck.