Skip to content

Expand Mermaid diagrams into a lightbox on click#151

Merged
HamptonMakes merged 1 commit into
block:mainfrom
jwils:joshuaw/mermaid-lightbox
Jul 17, 2026
Merged

Expand Mermaid diagrams into a lightbox on click#151
HamptonMakes merged 1 commit into
block:mainfrom
jwils:joshuaw/mermaid-lightbox

Conversation

@jwils

@jwils jwils commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Why

Mermaid diagrams render constrained to the content column, so anything beyond a trivial flowchart is too small to read.

What

  • Clicking a rendered diagram (or the expand button that appears on hover) opens it in a native <dialog> sized to the viewport, with the SVG scaled to fit
  • Click anywhere or press Escape to close; the dialog is removed on close and tagged data-turbo-temporary so Turbo never caches it
  • Extend the foreignObject line-height fix (Fix clipped mermaid node labels by pinning label line-height #149) to the lightbox, which lives outside .markdown-rendered
  • System spec covering expand and click-to-close

Risk Assessment

Low — additive UI behavior scoped to rendered Mermaid diagrams; no server-side changes.

Screenshots

Inline diagram with the expand affordance on hover:

Hover expand button

Clicking opens the lightbox, scaled to the viewport:

Expanded lightbox

For comparison, the same diagram inline before expanding:

Inline diagram

Diagrams are constrained to the content column width, which makes
larger flowcharts too small to read. Clicking a rendered diagram now
opens it in a full-viewport dialog; click anywhere or press Escape
to close.
@jwils
jwils marked this pull request as ready for review July 17, 2026 19:40
@jwils
jwils requested a review from HamptonMakes as a code owner July 17, 2026 19:40
@HamptonMakes

Copy link
Copy Markdown
Collaborator

Please write system specs for this!

@HamptonMakes
HamptonMakes merged commit 73ee5a6 into block:main Jul 17, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants