1
Fork 0

fix: switch to katex

This commit is contained in:
Tibo De Peuter 2026-05-19 23:17:17 +02:00
parent 97598105e5
commit f26312583a
3 changed files with 22 additions and 20 deletions

16
docs/javascripts/katex.js Normal file
View 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));
}

View file

@ -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();
});

View file

@ -11,6 +11,10 @@ markdown_extensions:
- pymdownx.arithmatex:
generic: true
extra_css:
- https://unpkg.com/katex@0/dist/katex.min.css
extra_javascript:
- javascripts/mathjax.js
- https://unpkg.com/mathjax@3/es5/tex-mml-chtml.js
- javascripts/katex.js
- https://unpkg.com/katex@0/dist/katex.min.js
- https://unpkg.com/katex@0/dist/contrib/auto-render.min.js