Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating to MathJax 3 #1691

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion nbconvert/exporters/html.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class HTMLExporter(TemplateExporter):
).tag(config=True)

mathjax_url = Unicode(
"https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/latest.js?config=TeX-AMS_CHTML-full,Safe",
"https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js",
help="""
URL to load Mathjax from.

Expand Down
34 changes: 34 additions & 0 deletions share/templates/base/mathjax3.html.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{%- macro mathjax(url="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js") -%}
<!-- Load mathjax -->
<!-- MathJax configuration -->
<script>
window.MathJax = {
tex: {
tags: "ams",
useLabelIds: true,
inlineMath: [ ['$','$'], ["\\(","\\)"] ],
displayMath: [ ['$$','$$'], ["\\[","\\]"] ],
processEscapes: true,
processEnvironments: true,
autoload: {
color: [],
colorv2: ['color']
},
packages: {'[+]': ['noerrors'], '[-]': ['textmacros']}
},
chtml: {
displayAlign: 'center'
},
options: {
ignoreHtmlClass: 'tex2jax_ignore',
processHtmlClass: 'tex2jax_process'
},
loader: {
load: ['[tex]/noerrors', '[tex]/textmacros', 'ui/safe']
}
};
</script>
<script src="{{url}}" id="MathJax-script"> </script>

<!-- End of mathjax configuration -->
{%- endmacro %}
2 changes: 1 addition & 1 deletion share/templates/classic/index.html.j2
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{%- extends 'base.html.j2' -%}
{% from 'mathjax.html.j2' import mathjax %}
{% from 'mathjax3.html.j2' import mathjax %}
{% from 'jupyter_widgets.html.j2' import jupyter_widgets %}

{%- block header -%}
Expand Down
2 changes: 1 addition & 1 deletion share/templates/lab/index.html.j2
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{%- extends 'base.html.j2' -%}
{% from 'mathjax.html.j2' import mathjax %}
{% from 'mathjax3.html.j2' import mathjax %}
{% from 'jupyter_widgets.html.j2' import jupyter_widgets %}

{%- block header -%}
Expand Down