mermaid icon indicating copy to clipboard operation
mermaid copied to clipboard

The inner library used by mermaid seems to support many useful formatting options

Open polymathuk opened this issue 5 years ago • 3 comments

The inner library used by mermaid seems to support node ranking (https://github.com/dagrejs/dagre/wiki#configuring-the-layout) through the graph.ranker value. Currently the only supported value by Mermaid is rankdir (TB, LR, RL...), but adding different props to the graph key could work.

Originally posted by @hugmanrique in https://github.com/mermaid-js/mermaid/issues/270#issuecomment-439637473

polymathuk avatar Oct 20 '20 08:10 polymathuk

Yet another layout options request. I see from #270 that there are many alignment and other useful formatting arguments that can be applied in the underlying renderer. Can we have a feature in Mermaid that it passes these arguments from the markup to the renderer? Presently we can use:

graph TB
    A[node A]-->B[node B]

What would be handy would be something like:

graph rankdir:TB, align:UL,
    A[node A] edge weight:1 --> B[node B]

Is this possible?

polymathuk avatar Oct 20 '20 08:10 polymathuk

Out of curiosity I did some testing on the align parameter of dagre and it worked pretty well in some use cases, maybe not all. But integrating this parameter should be possible. Don't know about the weight options though.

GDFaber avatar Oct 20 '20 08:10 GDFaber

Good idea. I have been thinking about this as well but never really got around to it. When this is implemented it should be done mainly for flowchart as that is the future of flowcharts, not graph.

knsv avatar Oct 22 '20 16:10 knsv