From 7e82641a14ebe2e2b279eb6400fe15122ea70b5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Mazzucotelli?= Date: Thu, 8 Oct 2026 12:20:32 +0200 Subject: [PATCH] fix: make mathjax instructions clearer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Timothée Mazzucotelli --- docs/authoring/math.md | 62 +++++++++++++++++++++--------------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/docs/authoring/math.md b/docs/authoring/math.md index aadf8b6..c6b4afa 100644 --- a/docs/authoring/math.md +++ b/docs/authoring/math.md @@ -21,37 +21,6 @@ such as [LaTeX], [MathML], [AsciiMath], as well as various output formats like HTML, SVG, MathML. To use MathJax within your project, add the following lines to your configuration: -=== "`docs/javascripts/mathjax.js`" - - ``` js - window.MathJax = { - tex: { - inlineMath: [["\\(", "\\)"]], - displayMath: [["\\[", "\\]"]], - processEscapes: true, - processEnvironments: true - }, - options: { - ignoreHtmlClass: ".*|", - processHtmlClass: "arithmatex" - } - }; - - document$.subscribe(() => { // (1)! - MathJax.startup.output.clearCache() - MathJax.typesetClear() - MathJax.texReset() - MathJax.typesetPromise() - }) - - component$.subscribe(({ ref }) => { - if (ref.classList.contains("md-annotation")) - MathJax.typesetPromise([ref]) - }) - ``` - - 1. This integrates MathJax with [instant navigation]. - === "`zensical.toml`" ``` toml @@ -77,6 +46,37 @@ to your configuration: - https://unpkg.com/mathjax@3/es5/tex-mml-chtml.js ``` +And create the `docs/javascripts/mathjax.js` file: + +``` js +window.MathJax = { + tex: { + inlineMath: [["\\(", "\\)"]], + displayMath: [["\\[", "\\]"]], + processEscapes: true, + processEnvironments: true + }, + options: { + ignoreHtmlClass: ".*|", + processHtmlClass: "arithmatex" + } +}; + +document$.subscribe(() => { // (1)! + MathJax.startup.output.clearCache() + MathJax.typesetClear() + MathJax.texReset() + MathJax.typesetPromise() +}) + +component$.subscribe(({ ref }) => { + if (ref.classList.contains("md-annotation")) + MathJax.typesetPromise([ref]) +}) +``` + +1. This integrates MathJax with [instant navigation]. + See additional configuration options: - [Arithmatex]