Formats
format attribute, and a Diagram Renderer for that format draws it. The examples use an editor set up as in the Flow diagrams quick start. What pasted text becomes is on Pasting.The formats
format | Source | Drawn by |
|---|---|---|
'mermaid' | Mermaid text | mermaid.js or Pele, see Mermaid diagrams |
'drawio' | draw.io XML | The draw.io Diagram Renderer, see draw.io diagrams |
'bpmn' | BPMN 2.0 XML with its layout | The BPMN Diagram Renderer, see BPMN diagrams |
| Another id | Stored as it is | A Diagram Renderer that lists it, see Other formats |
Mermaid diagrams
A diagram with format: 'mermaid' holds Mermaid text as written, without %%{…}%% directives
and frontmatter (see Source is data). Its first line names a
Mermaid kind:
editor.commands.insertFlowDiagram({ source: 'flowchart LR\n A --> B', title: 'Order process' })To draw it, register mermaidDiagramRenderer or
peleDiagramRenderer.
Next to mermaid.js compares them. Without
either, the diagram is inserted and shows what unavailable
returns, by default "This diagram can't be drawn here."
draw.io diagrams
A diagram with format: 'drawio' holds draw.io XML. The
draw.io Diagram Renderer draws it. The user changes it in the
draw.io editor, in an iframe you build, loaded from embed.diagrams.net unless you host a copy.
Its page has a demo and
the rules for the source. drawioXml is
your XML string:
editor.commands.insertFlowDiagram({ source: drawioXml, format: 'drawio', title: 'Order process' })BPMN diagrams
A diagram with format: 'bpmn' holds BPMN 2.0 XML with its layout (BPMN DI, the shape positions),
stored as written. The BPMN Diagram Renderer draws it
and connects bpmn-js, a BPMN editor.
Its page has a demo and the rules for the source. bpmnXml is your XML string:
editor.commands.insertFlowDiagram({ source: bpmnXml, format: 'bpmn', title: 'Payment check' })Other formats
A Diagram Renderer of your own can draw its own format. The id rules, the size limit and what happens when no Renderer draws it are on A format of your own.