Skip to content

Commit

Permalink
Upgrade KaTeX to 0.16.8
Browse files Browse the repository at this point in the history
  • Loading branch information
nhthn committed Aug 29, 2023
1 parent 2b10e99 commit 8203118
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 36 deletions.
1 change: 1 addition & 0 deletions nikola/conf.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -1025,6 +1025,7 @@ PRETTY_URLS = ${PRETTY_URLS}
# {left: "$$", right: "$$", display: true},
# {left: "\\\\[", right: "\\\\]", display: true},
# {left: "\\\\begin{equation*}", right: "\\\\end{equation*}", display: true},
# {left: "\\\\begin{align*}", right: "\\\\end{align*}", display: true},
# {left: "$", right: "$", display: false},
# {left: "\\\\(", right: "\\\\)", display: false}
# ]
Expand Down
41 changes: 23 additions & 18 deletions nikola/data/themes/base-jinja/templates/math_helper.tmpl
Original file line number Diff line number Diff line change
@@ -1,28 +1,33 @@
{# Note: at present, MathJax and KaTeX do not respect the USE_CDN configuration option #}
{% macro math_scripts() %}
{% if use_katex %}
<script src="https://cdn.jsdelivr.net/npm/katex@0.10.2/dist/katex.min.js" integrity="sha384-9Nhn55MVVN0/4OFx7EE5kpFBPsEMZxKTCnA+4fqDmg12eCTqGi6+BB2LjY8brQxJ" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/katex@0.10.2/dist/contrib/auto-render.min.js" integrity="sha384-kWPLUVMOks5AQFrykwIup5lo0m3iMkkHrD0uJ4H5cjeGihAutqP0yW0J6dpFiVkI" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/katex@0.16.8/dist/katex.min.js" integrity="sha384-cpW21h6RZv/phavutF+AuVYrr+dA8xD9zs6FwLpaCct6O9ctzYFfFr4dgmgccOTx" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/katex@0.16.8/dist/contrib/auto-render.min.js" integrity="sha384-+VBxd3r6XgURycqtZ117nYw44OOcIax56Z4dCRWbxyPt0Koah1uHoK0o4+/RRE05" crossorigin="anonymous"></script>
{% if katex_auto_render %}
<script>
renderMathInElement(document.body,
{
{{ katex_auto_render }}
}
);
document.addEventListener("DOMContentLoaded", function() {
renderMathInElement(document.body,
{
{{ katex_auto_render }}
}
);
});
</script>
{% else %}
<script>
renderMathInElement(document.body,
{
delimiters: [
{left: "$$", right: "$$", display: true},
{left: "\\[", right: "\\]", display: true},
{left: "\\begin{equation*}", right: "\\end{equation*}", display: true},
{left: "\\(", right: "\\)", display: false}
]
}
);
document.addEventListener("DOMContentLoaded", function() {
renderMathInElement(document.body,
{
delimiters: [
{left: "$$", right: "$$", display: true},
{left: "\\[", right: "\\]", display: true},
{left: "\\begin{equation*}", right: "\\end{equation*}", display: true},
{left: "\\begin{align*}", right: "\\end{align*}", display: true},
{left: "\\(", right: "\\)", display: false}
]
}
);
});
</script>
{% endif %}
{% else %}
Expand All @@ -40,7 +45,7 @@

{% macro math_styles() %}
{% if use_katex %}
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.10.2/dist/katex.min.css" integrity="sha384-yFRtMMDnQtDRO8rLpMIKrtPCD5jdktao2TV19YiZYWMDkUR5GQZR/NOVTdquEx1j" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.16.8/dist/katex.min.css" integrity="sha384-GvrOXuhMATgEsSwCs4smul74iXGOixntILdUW9XmUC6+HX0sLNAK3q71HotJqlAn" crossorigin="anonymous">
{% endif %}
{% endmacro %}

Expand Down
41 changes: 23 additions & 18 deletions nikola/data/themes/base/templates/math_helper.tmpl
Original file line number Diff line number Diff line change
@@ -1,28 +1,33 @@
### Note: at present, MathJax and KaTeX do not respect the USE_CDN configuration option
<%def name="math_scripts()">
%if use_katex:
<script src="https://cdn.jsdelivr.net/npm/katex@0.10.2/dist/katex.min.js" integrity="sha384-9Nhn55MVVN0/4OFx7EE5kpFBPsEMZxKTCnA+4fqDmg12eCTqGi6+BB2LjY8brQxJ" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/katex@0.10.2/dist/contrib/auto-render.min.js" integrity="sha384-kWPLUVMOks5AQFrykwIup5lo0m3iMkkHrD0uJ4H5cjeGihAutqP0yW0J6dpFiVkI" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/katex@0.16.8/dist/katex.min.js" integrity="sha384-cpW21h6RZv/phavutF+AuVYrr+dA8xD9zs6FwLpaCct6O9ctzYFfFr4dgmgccOTx" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/katex@0.16.8/dist/contrib/auto-render.min.js" integrity="sha384-+VBxd3r6XgURycqtZ117nYw44OOcIax56Z4dCRWbxyPt0Koah1uHoK0o4+/RRE05" crossorigin="anonymous"></script>
% if katex_auto_render:
<script>
renderMathInElement(document.body,
{
${katex_auto_render}
}
);
document.addEventListener("DOMContentLoaded", function() {
renderMathInElement(document.body,
{
${katex_auto_render}
}
);
});
</script>
% else:
<script>
renderMathInElement(document.body,
{
delimiters: [
{left: "$$", right: "$$", display: true},
{left: "\\[", right: "\\]", display: true},
{left: "\\begin{equation*}", right: "\\end{equation*}", display: true},
{left: "\\(", right: "\\)", display: false}
]
}
);
document.addEventListener("DOMContentLoaded", function() {
renderMathInElement(document.body,
{
delimiters: [
{left: "$$", right: "$$", display: true},
{left: "\\[", right: "\\]", display: true},
{left: "\\begin{equation*}", right: "\\end{equation*}", display: true},
{left: "\\begin{align*}", right: "\\end{align*}", display: true},
{left: "\\(", right: "\\)", display: false}
]
}
);
});
</script>
% endif
%else:
Expand All @@ -40,7 +45,7 @@

<%def name="math_styles()">
% if use_katex:
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.10.2/dist/katex.min.css" integrity="sha384-yFRtMMDnQtDRO8rLpMIKrtPCD5jdktao2TV19YiZYWMDkUR5GQZR/NOVTdquEx1j" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.16.8/dist/katex.min.css" integrity="sha384-GvrOXuhMATgEsSwCs4smul74iXGOixntILdUW9XmUC6+HX0sLNAK3q71HotJqlAn" crossorigin="anonymous">
% endif
</%def>

Expand Down

0 comments on commit 8203118

Please sign in to comment.