mermaid.flowchart

index · mermaid

Overview

A flowchart, from its statements to a frame: the parser, then the four steps of the layout in order.

Submodules

ModuleDescription
mermaid.flowchart.orderThe second step of a flowchart's layout: the order of each layer's nodes, chosen so that few links cross.
mermaid.flowchart.parserThe flowchart parser: statements in, a graph out.
mermaid.flowchart.placeThe third step of a flowchart's layout: each node's size in cells, and its place across the flow.
mermaid.flowchart.rankThe first step of a flowchart's layout: which layer each node stands in.
mermaid.flowchart.routeThe last step of a flowchart's layout: the layers' places along the flow, and each edge's route.

Functions

NameSignature
parseparse(statements, header) -> graph, err
layoutlayout(graph, compact, turned) -> frame, err

parse(statements, header) -> graph, err

Parse a flowchart's statements into a graph

statements and header are what mermaid.source.statements returns. The graph is mermaid.flowchart.parser.parse's, and layout takes it.

layout(graph, compact, turned) -> frame, err

Lay a flowchart out into a frame

graph is what parse returns. A graph may be laid out more than once: the layout reads it and writes nothing into it. With compact the diagram is laid out as tight as it reads: one blank cell where the usual layout leaves two or three, and labels wrapped at half the width.

A diagram is laid out as a flow down or to the right, and BT and RL are those two run the other way.

With turned the graph is laid out in the other flow: TD as LR, LR as TD, BT as RL and RL as BT. The frame is the one the same statements give under that other header.

Returns nil and a reason for a diagram of more than 4000 layout nodes, the dummies of its long edges counted, and for a subgraph that cannot be framed.