Skip to content

Commit

Permalink
move MathJax config to own module to prevent inline scripting
Browse files Browse the repository at this point in the history
  • Loading branch information
micahkepe committed Feb 9, 2025
1 parent ffc15f0 commit efa033a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 15 deletions.
12 changes: 12 additions & 0 deletions static/js/mathjax-config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
MathJax = {
tex: {
inlineMath: [
["$", "$"],
["\\(", "\\)"],
],
displayMath: [
["$$", "$$"],
["\\[", "\\]"],
],
},
};
20 changes: 5 additions & 15 deletions templates/partials/latex.html
Original file line number Diff line number Diff line change
@@ -1,18 +1,8 @@
{% if config.extra.latex %}
<!-- MathJax script for rendering LaTeX math equations -->
<script>
MathJax = {
tex: {
inlineMath: [
["$", "$"],
["\\(", "\\)"],
],
displayMath: [
["$$", "$$"],
["\\[", "\\]"],
],
},
};
</script>
<script src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js" async></script>
<script src="{{ get_url(path='js/mathjax-config.js') }}"></script>
<script
src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js"
async
></script>
{% endif %}

0 comments on commit efa033a

Please sign in to comment.