Skip to content

Commit

Permalink
config: add MathJax support
Browse files Browse the repository at this point in the history
  • Loading branch information
anikachurilova authored and kpsherva committed Sep 17, 2024
1 parent 75b8e2f commit d32d934
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
3 changes: 3 additions & 0 deletions invenio_theme/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,3 +182,6 @@
},
}
"""Icon definitions per theme."""

THEME_MATHJAX_CDN = ""
"""MathJax configuration for rendering mathematical formulas."""
13 changes: 13 additions & 0 deletions invenio_theme/templates/semantic-ui/invenio_theme/page.html
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,19 @@
{%- endblock body_inner %}

{%- block javascript %}

{% if config.THEME_MATHJAX_CDN %}
<script type="text/javascript">
window.MathJax = {
tex: {
inlineMath: [['$', '$'], ['\\(', '\\)']],
processEscapes: true // Allows escaping $ signs if needed
}
};
</script>
<script type="text/javascript" src="{{ config.THEME_MATHJAX_CDN }}"></script>
{% endif %}

{% include config.THEME_JAVASCRIPT_TEMPLATE %}
{%- endblock javascript %}

Expand Down

0 comments on commit d32d934

Please sign in to comment.