summaryrefslogtreecommitdiff
path: root/sphinx/ext/mathjax.py
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2018-06-01 17:23:08 +0900
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2018-07-29 22:36:53 +0900
commitda7a06b323e3990ce23125981016099a4e00db24 (patch)
treecd947efdb0e07e2727f56b9cb71895b88bc9d729 /sphinx/ext/mathjax.py
parent004b68f281dbad6e7598c8c2f56945bb3bc07107 (diff)
downloadsphinx-git-da7a06b323e3990ce23125981016099a4e00db24.tar.gz
WIP: #726, #969: Add mathjax_config
Diffstat (limited to 'sphinx/ext/mathjax.py')
-rw-r--r--sphinx/ext/mathjax.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/sphinx/ext/mathjax.py b/sphinx/ext/mathjax.py
index 20d5866c5..341eb12c8 100644
--- a/sphinx/ext/mathjax.py
+++ b/sphinx/ext/mathjax.py
@@ -11,6 +11,8 @@
:license: BSD, see LICENSE for details.
"""
+import json
+
from docutils import nodes
import sphinx
@@ -79,6 +81,10 @@ def builder_inited(app):
options.update(app.config.mathjax_options)
app.builder.add_js_file(app.config.mathjax_path, **options) # type: ignore
+ if app.config.mathjax_config:
+ body = "MathJax.Hub.Config(%s)" % json.dumps(app.config.mathjax_config)
+ app.builder.add_js_file(None, type="text/x-mathjax-config", body=body) # type: ignore # NOQA
+
def setup(app):
# type: (Sphinx) -> Dict[unicode, Any]
@@ -94,6 +100,7 @@ def setup(app):
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')
+ app.add_config_value('mathjax_config', None, 'html')
app.connect('builder-inited', builder_inited)
return {'version': sphinx.__display_version__, 'parallel_read_safe': True}