fix: switch to katex
This commit is contained in:
parent
97598105e5
commit
f26312583a
3 changed files with 22 additions and 20 deletions
16
docs/javascripts/katex.js
Normal file
16
docs/javascripts/katex.js
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
const renderMath = (el) => {
|
||||||
|
renderMathInElement(el, {
|
||||||
|
delimiters: [
|
||||||
|
{ left: "$$", right: "$$", display: true },
|
||||||
|
{ left: "$", right: "$", display: false },
|
||||||
|
{ left: "\\(", right: "\\)", display: false },
|
||||||
|
{ left: "\\[", right: "\\]", display: true }
|
||||||
|
],
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
if (typeof document$ !== "undefined") {
|
||||||
|
document$.subscribe(({ body }) => renderMath(body));
|
||||||
|
} else {
|
||||||
|
document.addEventListener("DOMContentLoaded", () => renderMath(document.body));
|
||||||
|
}
|
||||||
|
|
@ -1,18 +0,0 @@
|
||||||
window.MathJax = {
|
|
||||||
tex: {
|
|
||||||
inlineMath: [["\\(", "\\)"]],
|
|
||||||
displayMath: [["\\[", "\\]"]],
|
|
||||||
processEscapes: true,
|
|
||||||
processEnvironments: true
|
|
||||||
},
|
|
||||||
options: {
|
|
||||||
ignoreHtmlClass: ".*|",
|
|
||||||
processHtmlClass: "arithmatex"
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
document.addEventListener("DOMContentLoaded", () => {
|
|
||||||
MathJax.startup.document.state(0);
|
|
||||||
MathJax.typesetClear();
|
|
||||||
MathJax.typesetPromise();
|
|
||||||
});
|
|
||||||
|
|
@ -11,6 +11,10 @@ markdown_extensions:
|
||||||
- pymdownx.arithmatex:
|
- pymdownx.arithmatex:
|
||||||
generic: true
|
generic: true
|
||||||
|
|
||||||
|
extra_css:
|
||||||
|
- https://unpkg.com/katex@0/dist/katex.min.css
|
||||||
|
|
||||||
extra_javascript:
|
extra_javascript:
|
||||||
- javascripts/mathjax.js
|
- javascripts/katex.js
|
||||||
- https://unpkg.com/mathjax@3/es5/tex-mml-chtml.js
|
- https://unpkg.com/katex@0/dist/katex.min.js
|
||||||
|
- https://unpkg.com/katex@0/dist/contrib/auto-render.min.js
|
||||||
|
|
|
||||||
Reference in a new issue