I have a complex Mermaid diagram with many different subgraphs. It is large enough that it is hard to keep track of the order of different subgraphs. Sometimes I reorder them for clarity or positioning.
Unfortunately, the order of the subgraphs is important because the first time a node appears in the Markdown determines the subgraph that the Node will be a part of.
For instance, the following code:
flowchart LR
subgraph Subgraph 1
A
end
subgraph Subgraph 2
A --> B
end
Renders as:
Whereas the same code with the subgraphs reordered:
flowchart LR
subgraph Subgraph 2
A --> B
end
subgraph Subgraph 1
A
end
Renders differently:
Is there a way to mark a node as permanently anchored to a certain subgraph, in a way that is persistent across re-ordering the subgraphs?
For instance, it would be great if there was something like A$
in which the $
indicates that Node A should always be part of that subgraph.