summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2020-12-31 19:28:33 +0900
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2021-01-04 22:22:08 +0900
commitac7d574fceddd5dfbedea53af499080f39710aa6 (patch)
tree0343e4dde544abbe755d821d1a08db0baa1b0114
parent2d53b7cd6638a579fea23186762b1a561dadeb14 (diff)
downloadsphinx-git-ac7d574fceddd5dfbedea53af499080f39710aa6.tar.gz
refactor: mathjax: Add a constant for the URL of mathjax
-rw-r--r--sphinx/ext/mathjax.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/sphinx/ext/mathjax.py b/sphinx/ext/mathjax.py
index e4318f35d..141f61735 100644
--- a/sphinx/ext/mathjax.py
+++ b/sphinx/ext/mathjax.py
@@ -25,6 +25,11 @@ from sphinx.locale import _
from sphinx.util.math import get_node_equation_number
from sphinx.writers.html import HTMLTranslator
+# more information for mathjax secure url is here:
+# https://docs.mathjax.org/en/latest/start.html#secure-access-to-the-cdn
+MATHJAX_URL = ('https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/latest.js?'
+ 'config=TeX-AMS-MML_HTMLorMML')
+
def html_visit_math(self: HTMLTranslator, node: nodes.math) -> None:
self.body.append(self.starttag(node, 'span', '', CLASS='math notranslate nohighlight'))
@@ -92,11 +97,7 @@ def setup(app: Sphinx) -> Dict[str, Any]:
(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
- app.add_config_value('mathjax_path',
- 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/latest.js?'
- 'config=TeX-AMS-MML_HTMLorMML', 'html')
+ app.add_config_value('mathjax_path', MATHJAX_URL, 'html')
app.add_config_value('mathjax_options', {}, 'html')
app.add_config_value('mathjax_inline', [r'\(', r'\)'], 'html')
app.add_config_value('mathjax_display', [r'\[', r'\]'], 'html')