Get help from the marimo community

Updated 3 months ago

.center() changes size of flowchart

At a glance

The community member has created a flowchart using Mermaid, which is slightly larger than the output cell. When they use the .center() method, the chart gets smaller to fit in the cell. The community member is unsure if this is a desired behavior or a bug.

In the comments, other community members suggest that the behavior may be related to the recent upgrade to Mermaid v11, and that the chart may be at the cutoff of being too tall, causing the centering to change the padding slightly. One community member suggests sharing a screenshot to better understand the issue.

I have got this flowchart:

mo.mermaid(
"""
flowchart TD
B[B]
B --> CC]
C --> D[D]
D --> E[E]
E --> F[F]
F --> G[G]
G --> H[H]

%% Define a class for rounded rectangles with transparent fill
classDef roundedRect fill:transparent, stroke:#333, stroke-width:3px, rx:10, ry:10;

%% Apply the class to all nodes
class A,B,C,D,E,F,G,H roundedRect;
"""
)

which is slightly larger than the output cell. When I use the .center() method, the chart gets smaller to fit in the cell. Is it a desired behavior, or a bug?
M
k
4 comments
can you share a screenshot? i tried running this code and might be seeing somethign different
Attachment
image.png
also, i just upgraded mermaid to v11 in our repo (so i could be seeing something different b/c of that)
interestingly, I tried to put different stuff inside the nodes, and only this one on the screenshot does that.
Attachment
image.png
maybe its right at the cuttoff of being too tall. and when we center something, we wrap it in another <div> so maybe the extra html DOM element just happens to change the padding so slightly
Add a reply
Sign up and join the conversation on Discord