Mermaid diagrams are scaled to the column width instead of their own size
Categories
(Developer Infrastructure :: Source Documentation, defect)
Tracking
(firefox158 fixed)
| Tracking | Status | |
|---|---|---|
| firefox158 | --- | fixed |
People
(Reporter: dao, Assigned: dao)
References
(Blocks 1 open bug)
Details
Attachments
(1 external file)
sphinxcontrib-mermaid injects a stylesheet setting width: 100% and max-width: 100% !important on a diagram's SVG, inside a <pre> sized by mermaid_width. The !important overrides the max-width: <intrinsic>px mermaid sets on the SVG itself, so every diagram is scaled to the column: a narrow one is blown up, a wide one shrunk until its labels are unreadable. On the SessionStore events page of bug 2066123, at a 767px column, a 497x1362 flowchart renders at 720x1972 and a 341x663 one at 720x1400, so their 18px labels come out near 26px and 38px.
The fix needs both halves. useMaxWidth off in mermaid_init_config gives the SVG an intrinsic size; with it on the SVG carries a viewBox and no width, and a content-sized box collapses to the CSS default object size of 300px, which is why bug 2070769 concluded the box needed a definite width. docs/_static/custom_theme.css then overrides the injected rule so the SVG keeps that size, and the <pre> becomes a horizontal scroll container for a diagram wider than the column. ipc/docs/ipdl.md's four diagrams then render at 1289, 745, 585 and 850 pixels wide, the two over the column scrolling in place, where today all four are forced to 720.
A scrolled diagram is reachable by mouse and by the extension's fullscreen button, but a <pre> is not keyboard focusable and Firefox's overlay scrollbars leave the affordance invisible until it is scrolled. The theme's existing code blocks have the same gap, so that wants a follow-up rather than blocking this.
| Assignee | ||
Comment 1•2 months ago
|
||
Updated•2 months ago
|
| Assignee | ||
Updated•2 months ago
|
Comment 3•2 months ago
|
||
| bugherder | ||
Description
•