summaryrefslogtreecommitdiff
path: root/sphinx/ext/mathjax.py
diff options
context:
space:
mode:
authorAdam Turner <9087854+AA-Turner@users.noreply.github.com>2022-12-30 00:53:04 +0000
committerGitHub <noreply@github.com>2022-12-30 00:53:04 +0000
commitbf06d7ef4d808c1e743267c38b5faed08cf3f21a (patch)
tree0d41419b5bd57b9124ad4fcf1619b23f3f7ed23c /sphinx/ext/mathjax.py
parentaa2fa38feff75cf1f87755bf17417cd05c0be683 (diff)
downloadsphinx-git-bf06d7ef4d808c1e743267c38b5faed08cf3f21a.tar.gz
Factor out HTML 4 translator (#11051)
Move the HTML 4 translator into a private module.
Diffstat (limited to 'sphinx/ext/mathjax.py')
-rw-r--r--sphinx/ext/mathjax.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/sphinx/ext/mathjax.py b/sphinx/ext/mathjax.py
index e87e9ea64..9bdfc09c2 100644
--- a/sphinx/ext/mathjax.py
+++ b/sphinx/ext/mathjax.py
@@ -16,7 +16,7 @@ from sphinx.domains.math import MathDomain
from sphinx.errors import ExtensionError
from sphinx.locale import _
from sphinx.util.math import get_node_equation_number
-from sphinx.writers.html import HTMLTranslator
+from sphinx.writers.html import HTML5Translator
# more information for mathjax secure url is here:
# https://docs.mathjax.org/en/latest/start.html#secure-access-to-the-cdn
@@ -25,7 +25,7 @@ MATHJAX_URL = 'https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js'
logger = sphinx.util.logging.getLogger(__name__)
-def html_visit_math(self: HTMLTranslator, node: nodes.math) -> None:
+def html_visit_math(self: HTML5Translator, node: nodes.math) -> None:
self.body.append(self.starttag(node, 'span', '', CLASS='math notranslate nohighlight'))
self.body.append(self.builder.config.mathjax_inline[0] +
self.encode(node.astext()) +
@@ -33,7 +33,7 @@ def html_visit_math(self: HTMLTranslator, node: nodes.math) -> None:
raise nodes.SkipNode
-def html_visit_displaymath(self: HTMLTranslator, node: nodes.math_block) -> None:
+def html_visit_displaymath(self: HTML5Translator, node: nodes.math_block) -> None:
self.body.append(self.starttag(node, 'div', CLASS='math notranslate nohighlight'))
if node['nowrap']:
self.body.append(self.encode(node.astext()))