Mermaid.js rendering for Choreo.Dependency graphs.
Produces dependency-oriented visualisation:
- Applications — subroutine shapes
- Libraries — cylinder shapes
- Modules — rounded rectangles
- Interfaces — rhombus shapes
- Tests — rounded rectangles
Edge styles:
- uses — solid grey
- imports — dashed
- calls — dotted (styled as dashed in Mermaid with small dashes)
- inherits — solid bold
- dev — dashed grey
Layout is top-to-bottom by default so dependencies point downward.
Summary
Functions
Renders a dependency graph to a Mermaid diagram string.
Functions
@spec to_mermaid( Choreo.Dependency.t(), keyword() ) :: String.t()
Renders a dependency graph to a Mermaid diagram string.
Options
:syntax—:flowchart(default) or:class_diagram(nativeclassDiagramsyntax):theme—:default,:dark,:warm,:forest,:ocean, or aChoreo.Themestruct (for:flowchartsyntax):direction—:td(default),:lr,:bt,:rl:highlighted_nodes— list of node IDs to highlight (for:flowchartsyntax):highlighted_edges— list of edge IDs/tuples to highlight (for:flowchartsyntax)
Examples
iex> deps = Choreo.Dependency.new()
iex> deps = deps
...> |> Choreo.Dependency.add_application(:api, label: "API")
...> |> Choreo.Dependency.add_module(:auth, label: "Auth")
...> |> Choreo.Dependency.depends_on(:api, :auth)
iex> mermaid = Choreo.Dependency.Render.Mermaid.to_mermaid(deps)
iex> String.contains?(mermaid, "graph TD")
true
iex> String.contains?(mermaid, "API")
true
iex> String.contains?(mermaid, "Auth")
true
iex> deps = Choreo.Dependency.new() |> Choreo.Dependency.add_application(:api)
iex> mermaid = Choreo.Dependency.Render.Mermaid.to_mermaid(deps, syntax: :class_diagram)
iex> String.contains?(mermaid, "classDiagram")
true
iex> String.contains?(mermaid, "class api")
true