Skip to content

Port MathJax 3.2.2 to native Go - #1

Merged
alixander merged 1 commit into
mainfrom
agent/port-mathjax-3.2.2
Aug 9, 2026
Merged

Port MathJax 3.2.2 to native Go#1
alixander merged 1 commit into
mainfrom
agent/port-mathjax-3.2.2

Conversation

@alixander

@alixander alixander commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Summary

  • port the MathJax 3.2.2 TeX-to-SVG pipeline used by D2 to native Go
  • preserve the exact D2 package surface, MathML structure, SVG serialization, measurements, font metrics, glyph paths, and error rendering
  • expose stateless Render, RenderWithOptions, and Measure APIs with no production JavaScript runtime
  • document exact upstream provenance and Apache/MIT licensing
  • add pure-Go, race, Go-floor, WASM, and pinned frozen-oracle CI

Compatibility

This targets the custom MathJax 3.2.2 component frozen in D2, including base, mathtools, ams, amscd, braket, cancel, cases, color, gensymb, mhchem, and physics. JavaScript is used only by the optional external differential oracle and is not embedded in the library.

The suite freezes 31 D2 formulas, 107 selected handler render cases, 42 MathML definitions, 2,373 glyphs, 119 delimiters, and the mhchemParser 4.1.1 corpus.

Validation

  • GOWORK=off go test ./...
  • GOWORK=off go test -race ./...
  • GOWORK=off go vet ./...
  • GOWORK=off GOTOOLCHAIN=go1.23.12 go test ./...
  • GOOS=js GOARCH=wasm GOWORK=off go build ./...
  • full SHA-pinned D2 MathJax differential oracle

D2 integration

Linked draft: d2lang/d2#2824

@alixander
alixander marked this pull request as ready for review August 9, 2026 15:21
@alixander
alixander merged commit 24a238a into main Aug 9, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant