myst_parser.sphinx_ext.mathjax#

Overrides to sphinx.ext.mathjax

This fixes two issues:

  1. Mathjax should not search for $ delimiters, nor LaTeX amsmath environments, since we already achieve this with the dollarmath and amsmath mrakdown-it-py plugins

  2. amsmath math blocks should be wrapped in mathjax delimiters (default \[...\]), and assigned an equation number

1.  Module Contents#

1.1.  Functions#

log_override_warning

Log a warning if MathJax configuration being overridden.

override_mathjax

Override aspects of the mathjax extension.

html_visit_displaymath

Override for sphinx.ext.mathjax.html_visit_displaymath to handle amsmath.

1.2.  Data#

logger

1.3.  API#

myst_parser.sphinx_ext.mathjax.logger = 'getLogger(...)'#
myst_parser.sphinx_ext.mathjax.log_override_warning(app: sphinx.application.Sphinx, version: int, current: str, new: str) None[source]#

Log a warning if MathJax configuration being overridden.

myst_parser.sphinx_ext.mathjax.override_mathjax(app: sphinx.application.Sphinx)[source]#

Override aspects of the mathjax extension.

MyST-Parser parses dollar and latex math, via markdown-it plugins. Therefore, we tell Mathjax to only render these HTML elements. This is accompanied by setting the ignoreClass on the top-level section of each MyST document.

myst_parser.sphinx_ext.mathjax.html_visit_displaymath(self: sphinx.writers.html.HTMLTranslator, node: docutils.nodes.math_block) None[source]#

Override for sphinx.ext.mathjax.html_visit_displaymath to handle amsmath.

By default displaymath, are normally wrapped in a prefix/suffix, defined by mathjax_display, and labelled nodes are numbered. However, this is not the case if the math_block is set as β€˜nowrap’, as for amsmath. Therefore, we need to override this behaviour.