Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions notebook/base/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,10 @@ def mathjax_url(self):
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', '/')
Expand Down
3 changes: 2 additions & 1 deletion notebook/lab/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ def get(self):
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
Expand Down
1 change: 1 addition & 0 deletions notebook/notebook/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ def get(self, path):
notebook_name=name,
kill_kernel=False,
mathjax_url=self.mathjax_url,
mathjax_config=self.mathjax_config
)
)

Expand Down
10 changes: 10 additions & 0 deletions notebook/notebookapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ def init_settings(self, ipython_app, kernel_manager, contents_manager,
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,
Expand Down Expand Up @@ -728,6 +729,15 @@ def _mathjax_url_changed(self, name, old, new):
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):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't need a dynamic default here, it can be in the constructor:

mathjax_config = Unicode("TeX-AMS_HTML-full,Safe", config=True...

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,
Expand Down
2 changes: 1 addition & 1 deletion notebook/templates/lab.html
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion notebook/templates/notebook.html
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down