031 — md2html judges an embedded SVG's text at the 1344px container, px sizes only (#200)
Status: in progress
Why
The #112 check refuses an embedded SVG whose text the page would draw too small. It assumed a 960px page, but the page's container is Bulma's, up to 1344px wide on a fullhd screen: a 2082px diagram is drawn at 1344px and its 16px labels at 10.3px, which reads, yet the build refused it.
It also read every font-size as px. The CSS d2 embeds for markdown text
sets 1em and 2em, which were taken as 1px and 2px, so every such
diagram was refused as drawn at a fraction of a pixel.
What changes
tp md2html: an embedded SVG wider than the container is judged as shrunk to 1344px, not 960px, and refused when its smallest text is drawn under 10px, not 11px. A diagram with 16px labels may be 2150px wide rather than 1396px.tp md2html: only px and unitless font sizes count as label sizes;em,rem,ptand%sizes are skipped.README.md: the md2html paragraph states the container width, the 10px floor and the em exception.
Acceptance
Drawn text is the smallest px font size × width/viewBox width × min(1, 1344/width).
Root <svg> |
Smallest font | Drawn | Outcome |
|---|---|---|---|
| no width (d2's fit-to-screen) | — | — | error: render with d2 --scale 1 |
| 1258 wide, viewBox 1258 | 16px | 16px | ok |
| 2082 wide, viewBox 2082 | 16px | 10.3px | ok |
| 3827 wide, viewBox 3827 | 16px | 5.6px | error: make it at most 2150px wide |
1258 wide, 1em and 2em in a style block |
16px | 16px | ok |
600 wide, viewBox 1200 (--scale 0.5) |
16px | 8px | error |
| 400 wide, no text | — | — | ok |
| missing file | — | — | error |
Out of scope
- Resolving em, rem or % sizes against their parent to a px size.
- Judging at the reader's actual viewport: the check assumes the widest container, so a narrower screen may still draw the text smaller.
Decisions
None.
Done when
- tests express the acceptance table and pass
- spec updated (README.md)
- ADR written if a fork was resolved (none needed)
- roadmap ticked and stamped; changelog entry
- issue closed with a link to the release