flow/render/mermaid

Source: src/flow/render/mermaid.ts

A checked flow as a Mermaid flowchart: the structure and nothing else.

A sequence is arrows, a block is a subgraph, and each node that acts is one box with its kind and id. What changes the path is written on it: a choice case’s condition on its arrow, a loop’s until on its way back, every max, and on-fail: continue. reads: are left out: drawn as arrows, they would double and cross the ones that say what runs next. A call is one box, its callee drawn on its own.

Mermaid’s ids are numbered in drawing order rather than taken from the file, since an id such as end would end a subgraph: the text is the same for the same flow, and every label carries the node’s own id.

mermaidOf

function

export function mermaidOf(checked: CheckedFlow): string { /* … */ }

checked as the text of a Mermaid flowchart, pure.