Mermaid.js rendering for Choreo.FSM state-machine diagrams.
Produces classic state-machine visualisation:
- Normal states — filled circles
- Initial states — filled circles with a black entry-point dot
- Final states — circles with thick stroke (double-circle equivalent)
- Transitions — labeled arrows
- Layout is left-to-right by default
Themes
:default— light grey states, dark text, left-to-right:dark— dark background, neon accentsChoreo.Themestruct — full custom control
Examples
iex> fsm = Choreo.FSM.new() |> Choreo.FSM.add_state(:a)
iex> mermaid = Choreo.FSM.Render.Mermaid.to_mermaid(fsm)
iex> String.contains?(mermaid, "graph LR")
true
iex> String.contains?(mermaid, "a")
true
iex> fsm = Choreo.FSM.new() |> Choreo.FSM.add_initial_state(:idle) |> Choreo.FSM.add_final_state(:done)
iex> mermaid = Choreo.FSM.Render.Mermaid.to_mermaid(fsm, syntax: :state_diagram)
iex> String.contains?(mermaid, "stateDiagram-v2")
true
iex> String.contains?(mermaid, "[*] --> idle")
true
Summary
Functions
Returns a theme for Choreo.FSM Mermaid diagrams.
Renders an FSM to a Mermaid diagram string.
Functions
@spec theme( atom(), keyword() ) :: Choreo.Theme.t()
Returns a theme for Choreo.FSM Mermaid diagrams.
@spec to_mermaid( Choreo.FSM.t(), keyword() ) :: String.t()
Renders an FSM to a Mermaid diagram string.
Options
:syntax—:flowchart(default) or:state_diagram(nativestateDiagram-v2syntax):theme—:default,:dark,:warm,:forest,:ocean, or aChoreo.Themestruct (for:flowchartsyntax):direction—:lr(default),:td,:rl,:bt(for:flowchartsyntax):highlighted_nodes— list of state IDs to highlight (for:flowchartsyntax):highlighted_edges— list of edge IDs or{from, to}tuples to highlight (for:flowchartsyntax)- Any other option accepted by
Yog.Multi.Mermaid.to_mermaid/2