quarto-math: MathML Core writer (bd-9z83tcv0) - #709
Merged
Merged
Conversation
cscheid
added this pull request to stack #707
September 22, 2026 00:10
cscheid
added a commit
that referenced
this pull request
Sep 22, 2026
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Contributor
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
cscheid
marked this pull request as ready for review
September 23, 2026 18:38
Adds `Target::MathMl` and `crates/quarto-math/src/mathml.rs`: `MathAst`
to a complete `<math>` element for `format: html` (consumed by the
`MathMlStage` of bd-3evfzwal). Written against MathML Core only:
- coarse runs split into `mi`/`mn`/`mo` via `split::split_run`, one
letter per `mi`; `-` becomes U+2212, `'` a prime;
- symbols classify by alphabet (Greek → `mi`, uppercase Greek upright,
relations/arrows → `mo`); bare delimiters get `stretchy="false"`,
`\left…\right` fences stretch;
- big operators place limits by mode and the integral family keeps
side limits, `\limits` pins `movablelimits="false"`; functions get
U+2061 function application;
- `\mathbf`/`\mathbb`/`\mathcal`/… map characters into the Mathematical
Alphanumeric Symbols block (holes included) since Core keeps only
`mathvariant="normal"`; `\text` keeps edge spaces as NBSP;
- environments become `mtable` (fenced for matrices, `{` for cases,
right/left `columnalign` for aligned); a top-level `\\` becomes a
table of lines; `\cancel` emits `menclose` (plan decision 3).
The source TeX rides in `<semantics>` as an `application/x-tex`
annotation, so `Normalized` gains a `text` field.
Tests: a corpus-wide validity check (quick-xml walk: Core element
allowlist, fixed child counts, `mathvariant` only `normal`), 263
per-fixture snapshots, 13 structural tests, and unit tests for the
variant table and accents.
Also fixes a normalizer bug the snapshots exposed: primes were dropped
(`f'` → `f`; the committed Typst snapshot for `basic/prime` read
`f ( x ) = f ( x )`). mitex parses `f'` as an attachment without a
`^`/`_` operator and `attach` returned only the base. Now a prime is a
superscript `Sym`, repeated primes merge into `″`/`‴`/`⁗`, and `x'^2`
shares the superscript slot (5 tests in `normalize.rs`). The same
fixture shows mitex taking `= f` as the base of `f''` after a relation;
filed as bd-0mzhnxft.
Snapshots: 263 added (`integration__mathml__mathml__*`), 6 modified
(`basic/prime` and `scripts/prime-with-sup` for normalize, OMML and
Typst — the prime fix; the Typst one now shows the bd-0mzhnxft quirk
as `(= f)^(″)`).
Verification: `cargo xtask verify --skip-hub-build` green; quarto-math
checks for wasm32-unknown-unknown.
Plan: claude-notes/plans/2026-09-21-equation-numbering-and-mathml.md
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
cscheid
force-pushed
the
feature/bd-9z83tcv0-mathml-writer
branch
from
September 23, 2026 18:57
a345411 to
7597480
Compare
Plan doc: taken from the Phase 3 branch, which already carries the Phase 1 and Phase 2 checkbox updates both sides made. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This was referenced Sep 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Phase 2 of
claude-notes/plans/2026-09-21-equation-numbering-and-mathml.md(strand bd-9z83tcv0). Stacked on #706 (quarto-math); quarto-math only.What this adds
Target::MathMlandcrates/quarto-math/src/mathml.rs:MathAst→ one complete<math>element, written against MathML Core only (the subset every current browser renders natively):mi/mn/moviasplit::split_run, one letter permi;-becomes U+2212,'a prime;mi, uppercase Greek upright, relations/arrows →mo); bare delimiters getstretchy="false",\left…\rightfences stretch;\limitspinsmovablelimits="false"; functions get U+2061 function application;\mathbf/\mathbb/\mathcal/… map characters into the Mathematical Alphanumeric Symbols block (holes included), since Core keeps onlymathvariant="normal";\textkeeps edge spaces as NBSP;mtable(fenced matrices,{for cases, right/leftcolumnalignfor aligned); a top-level\\becomes a table of lines;\cancelemitsmenclose(plan decision 3).The source TeX rides in
<semantics>as anapplication/x-texannotation, soNormalizedgains atextfield.Tests
A corpus-wide validity check (quick-xml walk: Core element allowlist, fixed child counts for
mfrac/msub/…/munderover,mathvariantonlynormal), 263 per-fixture snapshots, 13 structural tests, unit tests for the variant table and accents.Normalizer fix found by the snapshots
Primes were dropped (
f'→f; the committed Typst snapshot forbasic/primereadf ( x ) = f ( x )). mitex parsesf'as an attachment without a^/_operator andattachreturned only the base. Now a prime is a superscriptSym, repeated primes merge into″/‴/⁗, andx'^2shares the superscript slot (5 tests innormalize.rs). Six snapshots changed (basic/prime,scripts/prime-with-sup× normalize/OMML/Typst). The same fixture shows mitex taking= fas the base off''after a relation — filed as bd-0mzhnxft.Verification
cargo xtask verify --skip-hub-buildgreen; the crate checks forwasm32-unknown-unknown.🤖 Generated with Claude Code