diff options
Diffstat (limited to 'sphinx/ext/mathjax.py')
-rw-r--r-- | sphinx/ext/mathjax.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/sphinx/ext/mathjax.py b/sphinx/ext/mathjax.py index 0d73f3d3d..20d5866c5 100644 --- a/sphinx/ext/mathjax.py +++ b/sphinx/ext/mathjax.py @@ -16,7 +16,6 @@ from docutils import nodes import sphinx from sphinx.errors import ExtensionError from sphinx.ext.mathbase import get_node_equation_number -from sphinx.ext.mathbase import setup_math as mathbase_setup from sphinx.locale import _ if False: @@ -69,7 +68,9 @@ def html_visit_displaymath(self, node): def builder_inited(app): # type: (Sphinx) -> None - if not app.config.mathjax_path: + if app.builder.format != 'html' or app.builder.math_renderer_name != 'mathjax': # type: ignore # NOQA + pass + elif not app.config.mathjax_path: raise ExtensionError('mathjax_path config value must be set for the ' 'mathjax extension to work') if app.builder.format == 'html': @@ -81,10 +82,9 @@ def builder_inited(app): def setup(app): # type: (Sphinx) -> Dict[unicode, Any] - try: - mathbase_setup(app, (html_visit_math, None), (html_visit_displaymath, None)) - except ExtensionError: - raise ExtensionError('sphinx.ext.mathjax: other math package is already loaded') + app.add_html_math_renderer('mathjax', + (html_visit_math, None), + (html_visit_displaymath, None)) # more information for mathjax secure url is here: # https://docs.mathjax.org/en/latest/start.html#secure-access-to-the-cdn |