Merge pull request #1409 from poke1024/mathjax

Configurable MathJax config
This commit is contained in:
Min RK 2016-05-11 14:29:01 +02:00
commit 0f2193cc4c
6 changed files with 19 additions and 3 deletions

View File

@ -159,6 +159,10 @@ class IPythonHandler(AuthenticatedHandler):
return url
return url_path_join(self.base_url, url)
@property
def mathjax_config(self):
return self.settings.get('mathjax_config', 'TeX-AMS_HTML-full,Safe')
@property
def base_url(self):
return self.settings.get('base_url', '/')

View File

@ -17,7 +17,8 @@ class LabHandler(IPythonHandler):
self.write(self.render_template('lab.html',
page_title='Jupyter Lab',
terminals_available=self.settings['terminals_available'],
mathjax_url=self.mathjax_url))
mathjax_url=self.mathjax_url,
mathjax_config=self.mathjax_config))
#-----------------------------------------------------------------------------
# URL to handler mappings

View File

@ -40,6 +40,7 @@ class NotebookHandler(IPythonHandler):
notebook_name=name,
kill_kernel=False,
mathjax_url=self.mathjax_url,
mathjax_config=self.mathjax_config
)
)

View File

@ -238,6 +238,7 @@ class NotebookWebApplication(web.Application):
nbextensions_path=ipython_app.nbextensions_path,
websocket_url=ipython_app.websocket_url,
mathjax_url=ipython_app.mathjax_url,
mathjax_config=ipython_app.mathjax_config,
config=ipython_app.config,
config_dir=ipython_app.config_dir,
jinja2_env=env,
@ -728,6 +729,15 @@ class NotebookApp(JupyterApp):
else:
self.log.info("Using MathJax: %s", new)
mathjax_config = Unicode("", config=True,
help="""The MathJax.js configuration file that is to be used."""
)
def _mathjax_config_default(self):
return 'TeX-AMS_HTML-full,Safe'
def _mathjax_config_changed(self, name, old, new):
self.log.info("Using MathJax configuration file: %s", new)
contents_manager_class = Type(
default_value=FileContentsManager,
klass=ContentsManager,

View File

@ -79,7 +79,7 @@
{% endblock %}
{% if mathjax_url %}
<script type="text/javascript" src="{{mathjax_url}}?config=TeX-AMS_HTML-full,Safe&amp;delayStartupUntil=configured" charset="utf-8"></script>
<script type="text/javascript" src="{{mathjax_url}}?config={{mathjax_config}}&amp;delayStartupUntil=configured" charset="utf-8"></script>
{% endif %}
</head>

View File

@ -3,7 +3,7 @@
{% block stylesheet %}
{% if mathjax_url %}
<script type="text/javascript" src="{{mathjax_url}}?config=TeX-AMS_HTML-full,Safe&delayStartupUntil=configured" charset="utf-8"></script>
<script type="text/javascript" src="{{mathjax_url}}?config={{mathjax_config}}&delayStartupUntil=configured" charset="utf-8"></script>
{% endif %}
<script type="text/javascript">
// MathJax disabled, set as null to distingish from *missing* MathJax,