Skip to content

Commit

Permalink
feat(deps): move MathJax configuration to a separate file (cotes202…
Browse files Browse the repository at this point in the history
…0#1670)

Move `MathJax` configuration to file `assets/js/data/mathjax.js` will help add extensions.
  • Loading branch information
cotes2020 authored and mill413 committed Apr 21, 2024
1 parent 75ae109 commit 6015bb9
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 19 deletions.
20 changes: 1 addition & 19 deletions _includes/js-selector.html
Original file line number Diff line number Diff line change
Expand Up @@ -72,25 +72,7 @@

{% if page.math %}
<!-- MathJax -->
<script>
/* see: <https://docs.mathjax.org/en/latest/options/input/tex.html#tex-options> */
MathJax = {
tex: {
/* start/end delimiter pairs for in-line math */
inlineMath: [
['$', '$'],
['\\(', '\\)']
],
/* start/end delimiter pairs for display math */
displayMath: [
['$$', '$$'],
['\\[', '\\]']
],
/* equation numbering */
tags: 'ams'
}
};
</script>
<script src="{{ '/assets/js/data/mathjax.js' | relative_url }}"></script>
<script src="https://cdnjs.cloudflare.com/polyfill/v3/polyfill.min.js?features=es6"></script>
<script id="MathJax-script" async src="{{ site.data.origin[type].mathjax.js | relative_url }}"></script>
{% endif %}
Expand Down
25 changes: 25 additions & 0 deletions assets/js/data/mathjax.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
layout: compress
# WARNING: Don't use '//' to comment out code, use '{% comment %}' and '{% endcomment %}' instead.
---

{%- comment -%}
See: <https://docs.mathjax.org/en/latest/options/input/tex.html#tex-options>
{%- endcomment -%}

MathJax = {
tex: {
{%- comment -%} start/end delimiter pairs for in-line math {%- endcomment -%}
inlineMath: [
['$', '$'],
['\\(', '\\)']
],
{%- comment -%} start/end delimiter pairs for display math {%- endcomment -%}
displayMath: [
['$$', '$$'],
['\\[', '\\]']
],
{%- comment -%} equation numbering {%- endcomment -%}
tags: 'ams'
}
};

0 comments on commit 6015bb9

Please sign in to comment.