From f7cbcf9be1c5e412c53c8a165aca3724cedf5d85 Mon Sep 17 00:00:00 2001 From: mirpedrol Date: Wed, 20 Dec 2023 17:42:58 +0100 Subject: [PATCH] replace katex bymathjax to fix rendering formula --- docs/javascripts/katex.js | 10 ---------- docs/javascripts/mathjax.js | 16 ++++++++++++++++ mkdocs.yml | 11 +++++------ 3 files changed, 21 insertions(+), 16 deletions(-) delete mode 100644 docs/javascripts/katex.js create mode 100644 docs/javascripts/mathjax.js diff --git a/docs/javascripts/katex.js b/docs/javascripts/katex.js deleted file mode 100644 index e1c8501..0000000 --- a/docs/javascripts/katex.js +++ /dev/null @@ -1,10 +0,0 @@ -document$.subscribe(({ body }) => { - renderMathInElement(body, { - delimiters: [ - { left: "$$", right: "$$", display: true }, - { left: "$", right: "$", display: false }, - { left: "\\(", right: "\\)", display: false }, - { left: "\\[", right: "\\]", display: true } - ], - }) -}) diff --git a/docs/javascripts/mathjax.js b/docs/javascripts/mathjax.js new file mode 100644 index 0000000..954b660 --- /dev/null +++ b/docs/javascripts/mathjax.js @@ -0,0 +1,16 @@ +window.MathJax = { + tex: { + inlineMath: [["\\(", "\\)"]], + displayMath: [["\\[", "\\]"]], + processEscapes: true, + processEnvironments: true + }, + options: { + ignoreHtmlClass: ".*|", + processHtmlClass: "arithmatex" + } +}; + +document$.subscribe(() => { + MathJax.typesetPromise() +}) \ No newline at end of file diff --git a/mkdocs.yml b/mkdocs.yml index aaaf7fa..6169abb 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -49,12 +49,9 @@ theme: - toc.follow extra_javascript: - - javascripts/katex.js - - https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.7/katex.min.js - - https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.7/contrib/auto-render.min.js - -extra_css: - - https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.7/katex.min.css + - javascripts/mathjax.js + - https://polyfill.io/v3/polyfill.min.js?features=es6 + - https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js markdown_extensions: - admonition @@ -74,6 +71,8 @@ markdown_extensions: - pymdownx.details - pymdownx.tasklist: custom_checkbox: true + - pymdownx.arithmatex: + generic: true plugins: - search