What happens: In a flowchart LR, if a node has a self-loop with a tall label, the label is drawn below the node (fine), but an equally tall block of empty space shows up above the row of nodes. The diagram ends up with a big gap at the top, and the gap grows with the label.
Expected: The diagram's height should fit what's actually drawn, so no empty space above the nodes when nothing is there.
Reproduce mermaid flowchart LR qs(("$$q_{start}$$")) -- "$$\epsilon, \epsilon \to E$ $$" --> ql(("$$q_{loop}$$")) ql -- "$$\begin{gathered} \epsilon, E \to E+E \ \epsilon, E \to E*E \ \epsilon, E \to (E) \ \epsilon, E \to \text{id} \ \epsilon, E \to \text{num} \ +, + \to \epsilon \quad *, * \to \epsilon \ (, ( \to \epsilon \quad ), ) \to \epsilon \ \text{id}, \text{id} \to \epsilon \quad \text{num}, \text{num} \to \epsilon \end{gathered}$$" --> ql ql -- "$$\epsilon, $ \to \epsilon$$" --> qa((("$$q_{accept}$$")))
Screenshot
Workaround Shortening the loop label shrinks the gap, but that means cramming the label onto fewer lines. I couldn't find a way to fix it from the diagram source or with CSS, since the space is part of the layout itself.
Activity
0No activity yet.