generated from srid/ema-template
-
Notifications
You must be signed in to change notification settings - Fork 79
Open
Description
Problem
Currently, math rendering requires client-side JavaScript loaded from CDNs:
- MathJax:
cdn.jsdelivr.net/npm/mathjax@3 - KaTeX:
cdn.jsdelivr.net/npm/katex@0.16.9(CSS + JS + auto-render)
These are opt-in via <snippet var="js.mathjax" /> or <snippet var="js.katex" /> in page.headHtml. Generated sites cannot render math when viewed offline.
Proposed Solution
Use Pandoc's built-in --mathml support (writerHTMLMathMethod = MathML) to render TeX math as native MathML elements at build time.
Implementation
- Set
writerHTMLMathMethod = MathMLin the Pandoc writer configuration - Pandoc will emit
<math>MathML elements directly in the HTML output - No client-side JavaScript needed — browsers render MathML natively
- Remove or deprecate
js.mathjaxandjs.katexsnippets (or keep as opt-in fallback) - Optionally add a small CSS snippet for MathML styling
Browser Support
Native MathML is supported in:
- Firefox (long-standing support)
- Safari (long-standing support)
- Chrome 109+ (January 2023)
This covers the vast majority of current browsers.
Benefits
- Generated site works fully offline
- No client-side JavaScript needed for math
- Faster page loads
- Math is part of the HTML document structure
Tradeoffs
- Very old browsers (Chrome < 109) won't render math correctly
- MathML rendering may look slightly different from MathJax/KaTeX
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels