diff --git a/docs/api_examples/template_path/project_templates/nbconvert/templates/classic_clone/index.html.j2 b/docs/api_examples/template_path/project_templates/nbconvert/templates/classic_clone/index.html.j2 index 85f23d09f..23d43537d 100644 --- a/docs/api_examples/template_path/project_templates/nbconvert/templates/classic_clone/index.html.j2 +++ b/docs/api_examples/template_path/project_templates/nbconvert/templates/classic_clone/index.html.j2 @@ -103,7 +103,7 @@ div#notebook-container{ {% endblock custom_css %} -{{ mathjax() }} +{{ mathjax(resources.mathjax_url) }} {%- block html_head_css -%} diff --git a/nbconvert/exporters/html.py b/nbconvert/exporters/html.py index d415f4afc..61a3fe769 100644 --- a/nbconvert/exporters/html.py +++ b/nbconvert/exporters/html.py @@ -50,6 +50,15 @@ class HTMLExporter(TemplateExporter): """ ).tag(config=True) + mathjax_url = Unicode( + "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/latest.js?config=TeX-MML-AM_CHTML-full,Safe", + help=""" + URL to load Mathjax from. + + Defaults to loading from cdnjs. + """ + ).tag(config=True) + jquery_url = Unicode( "https://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.3/jquery.min.js", help=""" @@ -169,6 +178,7 @@ def resources_include_url(name): resources['include_js'] = resources_include_js resources['include_url'] = resources_include_url resources['require_js_url'] = self.require_js_url + resources['mathjax_url'] = self.mathjax_url resources['jquery_url'] = self.jquery_url resources['jupyter_widgets_base_url'] = self.jupyter_widgets_base_url resources['html_manager_semver_range'] = self.html_manager_semver_range diff --git a/share/jupyter/nbconvert/templates/classic/index.html.j2 b/share/jupyter/nbconvert/templates/classic/index.html.j2 index 4a313d1fa..3e92fe364 100644 --- a/share/jupyter/nbconvert/templates/classic/index.html.j2 +++ b/share/jupyter/nbconvert/templates/classic/index.html.j2 @@ -74,7 +74,7 @@ div#notebook-container{ {% endblock notebook_css %} {%- block html_head_js_mathjax -%} -{{ mathjax() }} +{{ mathjax(resources.mathjax_url) }} {%- endblock html_head_js_mathjax -%} {%- block html_head_css -%} diff --git a/share/jupyter/nbconvert/templates/lab/index.html.j2 b/share/jupyter/nbconvert/templates/lab/index.html.j2 index 262e08059..d4cb8ecc9 100644 --- a/share/jupyter/nbconvert/templates/lab/index.html.j2 +++ b/share/jupyter/nbconvert/templates/lab/index.html.j2 @@ -67,7 +67,7 @@ a.anchor-link { {% endblock notebook_css %} {%- block html_head_js_mathjax -%} -{{ mathjax() }} +{{ mathjax(resources.mathjax_url) }} {%- endblock html_head_js_mathjax -%} {%- block html_head_css -%} diff --git a/share/jupyter/nbconvert/templates/reveal/index.html.j2 b/share/jupyter/nbconvert/templates/reveal/index.html.j2 index 07922cc28..777862b98 100644 --- a/share/jupyter/nbconvert/templates/reveal/index.html.j2 +++ b/share/jupyter/nbconvert/templates/reveal/index.html.j2 @@ -92,7 +92,7 @@ a.anchor-link { {% endblock notebook_css %} {%- block html_head_js_mathjax -%} -{{ mathjax() }} +{{ mathjax(resources.mathjax_url) }} {%- endblock html_head_js_mathjax -%} {%- block html_head_css -%}