Three reference files, each stating whether a fact was measured, read from source, or asserted — an unattributed number is a rumour. math-on-the-web: MathML is the only no-JS route, the one pure-Go TeX→MathML library is an untagged 2023 commit, and writing MathML directly costs nothing since raw HTML renders. syntax-highlighting-choices: chroma is two modules and ~5MB, every alternative a search returns is JavaScript, and custom lexers load from XML at runtime without a rebuild. goldmark-behaviours: the seven surprises that caused or nearly caused defects — strikethrough claiming a single tilde, delimiter runs pairing across whitespace, per-parse heading id counters, footnote id prefixes, raw HTML being dropped rather than escaped, the language class already in the output, and ParseFS globbing.
29 lines
1.7 KiB
Markdown
29 lines
1.7 KiB
Markdown
# Rendering maths without JavaScript
|
|
|
|
Established 2026-08-02 by searching, then querying the Go module proxy directly. Re-check before relying
|
|
on the library situation; the browser facts are stable.
|
|
|
|
## The shape of the problem
|
|
|
|
KaTeX and MathJax are JavaScript. A site that refuses client-side script cannot use them at runtime, so the
|
|
only no-JS route is **TeX → MathML at render time**. MathML is native browser markup: Firefox and Safari
|
|
have supported it for years, Chromium since 2023 (MathML Core). No script, no font loading, no layout pass
|
|
of our own.
|
|
|
|
## Go libraries, as of August 2026
|
|
|
|
| Module | State | Verdict |
|
|
|---|---|---|
|
|
| `git.sr.ht/~mekyt/latex2mathml` | Pure Go, a port of the Python library of the same name. **No tagged release** — latest resolves to `v0.0.0-20231214134936-808832af73fc`, a bare commit from December 2023. sourcehut returned a 502 while this was checked | The only real candidate, and the weakest dependency this project would have taken |
|
|
| `codeberg.org/go-latex/latex` | Properly versioned (v0.3.0), maintained | **Wrong output** — it draws equations, MathJax-style, rather than emitting MathML |
|
|
| `jgm/texmath` | Mature, well maintained | Haskell. Usable only as a service, which fails the sovereignty test |
|
|
|
|
`go list -m -versions git.sr.ht/~mekyt/latex2mathml` prints the module path with no versions after it, which
|
|
is how an untagged module reports.
|
|
|
|
## The option that costs nothing
|
|
|
|
Since raw HTML renders for site-root content (ADR-0060), **MathML can be written straight into a bundle**.
|
|
Verbose by hand, no dependency, no script, correct output. `$…$` sugar can be added later over the same
|
|
output without changing anything downstream, so choosing this now forecloses nothing.
|