EPUB: every numbered display fails EPUBCheck 5.3.0 because MathJax's SVG carries `data-mjx-viewBox`
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- Mezza giornata
- Idoneità per principianti
- 55/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Tranquilla
- Stack tecnologico
- html, xml
- Ambito
- content
Direzione di ricerca
Start with the EPUB assembly step where the SVG from the math representations file is pasted into the XHTML, and reproduce with -c doc -f epub-svg on a document with one numbered display, then run epubcheck. The fix is to move data-mjx-viewBox back to viewBox on the svg element and drop the data attribute, which MathJax's runtime would otherwise do. Done means epubcheck 5.3.0 reports no HTM_061 errors and the static SVG keeps its viewBox.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Summary
An epub-svg build of an article with 40 numbered displays fails EPUBCheck 5.3.0 with
40 errors, one per numbered display, all the same:
ERROR(HTM_061): .../EPUB/xhtml/section-infinitely-many-zeros.xhtml(53,13582):
"data-mjx-viewBox" is not a valid custom data attribute (it must have at least one
character after the hyphen, be XML-compatible, and not contain ASCII uppercase letters).
An article with mathematics but no numbered display validates clean. Inline
mathematics and unnumbered displays are not affected.
The attribute comes from MathJax itself, not from PreTeXt's driver script, and the
name violates HTML's rule for custom data attributes. So this is partly ours to
absorb in the EPUB assembly and partly something to raise with the MathJax people.
What MathJax does
@mathjax/src 4.1.3, output/svg.js, createRoot: when a display's bounding box has
a percentage width (pwidth), which a tagged equation always has so that the number
can sit at the margin, the SVG is given width="100%", its real viewBox is copied into
data-mjx-viewBox, and the viewBox attribute is removed. The browser-side runtime
restores the viewBox from that stash when it lays the display out. In an EPUB there is
no runtime, so the SVG is left with a data-mjx-viewBox that nothing reads and, as a
side effect, with no viewBox at all.
The element as it appears in the XHTML:
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
style="vertical-align: -0.566ex; min-width: 36.166ex;" width="100%" height="2.262ex"
role="img" data-mjx-viewBox="0 -750 15985.2 1000"
aria-labelledby="equation-polynomial-growth-bound-title"
aria-describedby="equation-polynomial-growth-bound-desc">
Reproduce
Any document with a numbered display, for example
<md number="yes" xml:id="equation-growth-bound">\log(\lvert f(z) \rvert) \lt \mathcal{N} \log(\lvert z \rvert).</md>
built with -c doc -f epub-svg, then
java -jar epubcheck-5.3.0/epubcheck.jar <file>.epub
One HTM_061 per numbered display. Counted against the article in question: 40
numbered displays, 40 errors, and the same 40 data-mjx-viewBox attributes in the XHTML.
A note on the validator
This is reported by the latest EPUBCheck, 5.3.0 (2025-09-01), validating against
EPUB 3.3. Older releases do not report it.
Proposed fix
In the EPUB assembly, at the point where the SVG from the math representations file is
pasted into the XHTML: restore viewBox from data-mjx-viewBox and drop the data
attribute. That both satisfies the validator and gives the static SVG back the
viewBox MathJax would have restored at runtime. Merely lowercasing the name would
satisfy the validator but leave the SVG without its viewBox.
And maybe we need to talk to the MathJax folks: a data-* attribute name with an
uppercase letter is invalid in any HTML or XHTML document, runtime or not, so the stash
would be better named data-mjx-viewbox, or restored before serialization when the
output is not going to a live page.
Environment
PreTeXt master at 59cd06c1 (2026-09-03); pretext/pretext -c doc -f epub-svg with a
publication file; MathJax @mathjax/src 4.1.3 and speech-rule-engine 5.0.0-rc.4 under
node 24.3.0; EPUBCheck 5.3.0.
Claude Fable 5.1, acting as a coding assistant for Rob Beezer
- Lingua principale
- XSLT
- Stelle
- 466
- Fork
- 251
- Merge medio
- 4m
- PR unite (30g)
- 13
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di PreTeXtBook/pretext
-
The print preview leaves writing space short by the margins of hidden headers, footers and solutionsAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
PreTeXtBook/pretext#3329 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 1-3 ore Idoneità per principianti 82/100
PreTeXtBook/pretext#3305 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
PreTeXtBook/pretext#3297 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
PreTeXtBook/pretext#3285 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
PreTeXtBook/pretext#3283 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di PreTeXtBook/pretext
Issue simili
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 72/100
lingdojo/kana-dojo#34261 · 1 commento · 5 reazioni ·
I maintainer di solito rispondono entro 1 giorno
-
org-claim
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 75/100
camp-registry/camp-index#776 ·
I maintainer di solito rispondono entro 1 giorno
-
teaching-followup
Difficoltà 1/5 1-3 ore Idoneità per principianti 72/100
Openscapes/kyber#196 ·
-
bug discord guide:03-ashenvale locale:enUS triage v4.0.1
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 67/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 76/100
datum-cloud/awesome-alt-clouds#610 ·
I maintainer di solito rispondono entro 1 giorno