EPUB: every numbered display fails EPUBCheck 5.3.0 because MathJax's SVG carries `data-mjx-viewBox`
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- Medio día
- Aptitud para principiantes
- 55/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Tranquilo
- Stack tecnológico
- html, xml
- Área
- content
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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
- Lenguaje dominante
- XSLT
- Estrellas
- 466
- Forks
- 251
- Merge medio
- 4 min
- PR fusionados (30 d)
- 13
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de PreTeXtBook/pretext
-
The print preview leaves writing space short by the margins of hidden headers, footers and solutionsAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
PreTeXtBook/pretext#3329 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 1-3 horas Aptitud para principiantes 82/100
PreTeXtBook/pretext#3305 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
PreTeXtBook/pretext#3297 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
PreTeXtBook/pretext#3285 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
PreTeXtBook/pretext#3283 ·
Los mantenedores suelen responder en 1 día
Todos los issues de PreTeXtBook/pretext
Issues similares
-
The Missing Diplomat in WetlandsAbiertobug discord guide:03-ashenvale locale:enUS triage v4.0.1
Dificultad 1/5 Menos de una hora Aptitud para principiantes 67/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 67/100
ilan-pinto/roaring-lions#1552 ·
Los mantenedores suelen responder en 1 día
-
Project submission: Landed MCPAbierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 72/100
eryajf/learning-weekly#207 ·
-
[workshop-sim] Improve: Add predict-and-check practice and checkpoint to Step 4 Actions introAbiertofeedback simulation workshop
Dificultad 2/5 1-3 horas Aptitud para principiantes 69/100
githubnext/gh-aw-workshop#5826 ·
Los mantenedores suelen responder en 1 día