Skip to content

fix: improve Mermaid figure layout when a caption is present - #364

Merged
rich-iannone merged 4 commits into
mainfrom
fix-mermaid-caption
Oct 6, 2026
Merged

rich-iannone merged 4 commits into
mainfrom
fix-mermaid-caption

Conversation

@rich-iannone

@rich-iannone rich-iannone commented Oct 6, 2026 •

Copy link
Copy Markdown
Member

This PR addresses an issue where a Mermaid diagram with a fig-cap rendered very small, with its caption to the right of the SVG instead of underneath.

The fix makes the figure now stack things vertically (flex-direction: column; align-items: stretch), so the caption sits under the diagram. Captions are centered to match the centered diagram. Small diagrams keep their natural size, where Mermaid's inline max-width on the SVG is left alone. Uncaptioned diagrams look the same as before.

I added a new GDG site (gdtest_mermaid) with three diagrams: a wide one with a labeled caption, a small one with an unlabeled caption, and one with no caption.

Here's how figures now render with Mermaid in Great Docs:

image

Fixes: #361

@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown

📚 Preview this PR's docs locally

Fetch the just-built site and open it in your browser:

# this exact build
great-docs preview --run 37478012777

# or always the latest build for this PR
great-docs preview --pr 364
Auth & tips
  • Requires great-docs: pip install great-docs (or run via pipx/uvx).
  • Auth: run gh auth login then add --use-gh, or set GITHUB_TOKEN (needs Actions: read).
  • Jump to a page: add --path reference/index.html.
  • Latest vs exact: --pr <n> grabs the newest build; --run <id> pins this one.
  • Re-download: --refresh ignores the local cache.

@rich-iannone
rich-iannone merged commit de82be0 into main Oct 6, 2026
8 checks passed
@rich-iannone
rich-iannone deleted the fix-mermaid-caption branch October 6, 2026 14:56
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.

Mermaid figures with captions sit beside the diagram instead of full width

1 participant