Mermaid.js rendering for Choreo.Workflow orchestration diagrams.
Produces workflow-oriented visualisation:
- Start — green circle (entry point)
- End — red circle with thick stroke (terminal)
- Task — subroutine rectangles (automated steps)
- Decision — rhombus (conditional branch)
- Fork — trapezoid (parallel split)
- Join — trapezoid alt (parallel merge)
- Compensation — rounded rectangle with red dashed border (rollback)
- Event — rounded rectangle (trigger / signal)
Edge styles:
- Sequence — solid grey
- Compensation — dashed red
- Retry — dashed orange
- Failure — dashed grey
- Timeout — dashed yellow
Swimlanes are rendered as Mermaid subgraphs with optional fill colours.
Further reading
Summary
Functions
Returns a theme for Choreo.Workflow Mermaid diagrams.
Renders a workflow to a Mermaid flowchart string.
Functions
@spec theme( atom(), keyword() ) :: Choreo.Theme.t()
Returns a theme for Choreo.Workflow Mermaid diagrams.
@spec to_mermaid( Choreo.Workflow.t(), keyword() ) :: String.t()
Renders a workflow to a Mermaid flowchart string.
Options
:theme—:default,:dark,:warm,:forest,:ocean, or aChoreo.Themestruct:direction—:td(default),:lr,:bt,:rl:highlighted_nodes— list of node IDs to highlight:highlighted_edges— list of edge IDs or{from, to}tuples to highlight- Any other option accepted by
Yog.Multi.Mermaid.to_mermaid/2
Examples
iex> workflow = Choreo.Workflow.new()
iex> workflow = workflow
...> |> Choreo.Workflow.add_start(:start)
...> |> Choreo.Workflow.add_task(:process)
...> |> Choreo.Workflow.add_end(:end)
...> |> Choreo.Workflow.connect(:start, :process)
...> |> Choreo.Workflow.connect(:process, :end)
iex> mermaid = Choreo.Workflow.Render.Mermaid.to_mermaid(workflow)
iex> String.contains?(mermaid, "graph TD")
true
iex> String.contains?(mermaid, "process")
true