Skip to content

@eightkk/vue-weave / core / toMermaid

Function: toMermaid() ​

toMermaid(graph, options?): string

Defined in: src/core/interchangeMermaid.ts:109

Write a diagram as a Mermaid flowchart. Each node is declared once with its shape ([ ] box, ( ) rounded, { } diamond, (( )) ellipse and circle, hexagon, ([ ]) stadium, [( )] cylinder, [/ /] parallelogram; other shapes, such as document and data-object, as boxes) and its quoted label, followed by <br> and the detail when it has one. Groups become nested subgraph … end blocks with their direct members; edges follow at the end, --> for an arrow (and any other end marker without a Mermaid form), --- for markerEnd: 'none', --o for a circle and --x for a bar, with a matching start marker (<-->, o--o, x--x) when markerStart has the same form, and the label as |"…"|. Characters that would end a label (", |, #, <, >, &, backticks and line breaks) are written as Mermaid entity codes such as #34;. IDs that Mermaid cannot hold are encoded (see fromMermaid); a group whose encoded ID is also a node's gets a suffix. Positions, sizes, tones, ports, waypoints and edge styles have no Mermaid form and are not written. Throws the Errors and RangeErrors of NetworkGraph's input checks and an Error for an unknown direction.

Parameters ​

graph ​

GraphInterchangeInput

options? ​

MermaidOptions = {}

Returns ​

string

Released under the MIT License.