Skip to content

Commit

Permalink
Allow child templates to override mathjax (#1551)
Browse files Browse the repository at this point in the history
Right now, mathjax is loaded synchronously in <head>, causing
render to block before moving forward. This is problematic,
especially since most notebooks don't actually have any
math to render.

This PR allows mathjax to be customized by child templates
that inherit from lab or classic. They can make it empty,
and load mathjax how they want - in the footer, only if
there is any math to be rendered, etc.

This should cause no difference in structure for the
default templates themselves.
  • Loading branch information
yuvipanda authored May 6, 2021
1 parent a365a5c commit d7c286b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions share/jupyter/nbconvert/templates/classic/index.html.j2
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ div#notebook-container{
</style>
{% endblock notebook_css %}

{%- block html_head_js_mathjax -%}
{{ mathjax() }}
{%- endblock html_head_js_mathjax -%}

{%- block html_head_css -%}
{%- endblock html_head_css -%}
Expand Down
2 changes: 2 additions & 0 deletions share/jupyter/nbconvert/templates/lab/index.html.j2
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ a.anchor-link {

{% endblock notebook_css %}

{%- block html_head_js_mathjax -%}
{{ mathjax() }}
{%- endblock html_head_js_mathjax -%}

{%- block html_head_css -%}
{%- endblock html_head_css -%}
Expand Down

0 comments on commit d7c286b

Please sign in to comment.