fix: prevent mermaid LR diagrams from being squished#8230
fix: prevent mermaid LR diagrams from being squished#8230AhmadYasser1 wants to merge 1 commit intomarimo-team:mainfrom
Conversation
|
@AhmadYasser1 this is great, thank you. any chance you can share a screenshot of the change (before and after)? |
|
thanks for the screenshot! and all the effort on these PRs. do you know if its possible to have something in between the two options? its full width without the overflow? no worries if its hard to figure out (i think myself and others have tried as well) |
|
tried a few approaches for a middle ground ( the |
|
thanks for exhaustively checking @AhmadYasser1
This is good to know. I think consistency would make sense. I will defer to @Light2Dark or @manzt for some final thoughts or other ideas. Maybe we want to explore navigation buttons (zoom-in/out) or a toggle. |
|
responded on original issue, it feels like the issue is with |
Set flowchart `useMaxWidth: false` so SVGs render at natural pixel width instead of scaling to container width. This matches how GitHub and other tools render mermaid diagrams, and prevents LR flowcharts from being compressed when inside flex layouts (e.g. `.center()` wraps content in an `hstack` flex container). Wrap the SVG output in a scrollable container with `max-width: 100%` so: - Wide diagrams scroll horizontally instead of overflowing - Narrow diagrams keep their natural size (preserving `.center()`) Closes marimo-team#6697
|
thanks @Light2Dark .center() wraps content in hstack which creates a flex container, and the svg's width: 100% (from useMaxWidth: true) sizes relative to that constrained flex item. updated the fix:
|
f8cdd05 to
97bee3a
Compare
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|


Summary
LR (left-to-right) mermaid diagrams were compressed to fit the container width because
flowchart.useMaxWidthdefaults totrue. Sets it tofalseso diagrams render at natural size, and wraps the output in a scrollable container.Closes #6697
Test Plan