mermaid.layout

mermaid

layout(source, opts) -> frame, err

Lay a diagram's source out into a frame

Parses the source by its diagram type and lays it out on the cell grid. Returns a frame that passes mermaid.frame.check, with frame.kind set to "flowchart" or "sequence". Any painter can read it. The source's accTitle and accDescr go on the frame as frame.title and frame.descr, when it has them.

opts:

FieldHolds
max_colspast this width the diagram is laid out once more, compact
compactlay the diagram out compact from the start
turnedlay a flowchart out in its other flow: TD as LR, BT as RL, and back

A frame still wider than max_cols after the compact layout is returned all the same. The caller decides what a too wide frame costs.

The retry for max_cols never changes the direction. A chart is turned only when the caller asks for it, and both its tries are then turned.

Returns nil and a reason for a diagram type other than a flowchart and a sequence diagram, a source its parser refuses, a diagram the layout does not draw, and a frame that fails the check. turned on a sequence diagram, which has one direction, returns nil and "a diagram with one direction".