From aa0dc226d500562752360c496a5237788f0e1a15 Mon Sep 17 00:00:00 2001 From: Hugo Date: Fri, 9 Aug 2024 15:42:07 +0200 Subject: [PATCH] Latex: add Katex to mkdocs (#148) * Latex: add Katex to mkdocs * add EOF --- javascripts/katex.js | 12 ++++++++++++ mkdocs/mkdocs.yml | 9 +++++++++ 2 files changed, 21 insertions(+) create mode 100644 javascripts/katex.js diff --git a/javascripts/katex.js b/javascripts/katex.js new file mode 100644 index 000000000..84b165367 --- /dev/null +++ b/javascripts/katex.js @@ -0,0 +1,12 @@ +document$.subscribe(({ body }) => { + + + renderMathInElement(body, { + delimiters: [ + { left: "$$", right: "$$", display: true }, + { left: "$", right: "$", display: true }, + { left: "\\(", right: "\\)", display: false }, + { left: "\\[", right: "\\]", display: false } + ], + }) +}) diff --git a/mkdocs/mkdocs.yml b/mkdocs/mkdocs.yml index a76299fdf..82a5a4d60 100644 --- a/mkdocs/mkdocs.yml +++ b/mkdocs/mkdocs.yml @@ -60,4 +60,13 @@ markdown_extensions: - pymdownx.superfences - pymdownx.tabbed: alternate_style: true + - pymdownx.arithmatex: + generic: true +extra_javascript: + - javascripts/katex.js + - https://unpkg.com/katex@0/dist/katex.min.js + - https://unpkg.com/katex@0/dist/contrib/auto-render.min.js + +extra_css: + - https://unpkg.com/katex@0/dist/katex.min.css