Choreo.MindMap.Render.Mermaid (Choreo v0.8.0)

Copy Markdown View Source

Mermaid.js rendering for Choreo.MindMap diagrams.

Produces mind-map-oriented visualisation:

  • Root — circle with thick stroke (central concept)
  • Topics — rounded rectangles (main branches)
  • Subtopics — boxes (nested ideas)
  • Notes — rounded rectangles with distinct colour (annotations)

Edge styles:

  • Branch — solid grey (hierarchical connection)
  • Associates — dashed grey, bidirectional (cross-link)
  • Virtual — dashed light grey (zoom-level transitive links)

Further reading

Summary

Functions

Returns a theme for Choreo.MindMap Mermaid diagrams.

Renders a mind map to a Mermaid flowchart string.

Functions

theme(name \\ :default, overrides \\ [])

@spec theme(
  atom(),
  keyword()
) :: Choreo.Theme.t()

Returns a theme for Choreo.MindMap Mermaid diagrams.

to_mermaid(map, opts \\ [])

@spec to_mermaid(
  Choreo.MindMap.t(),
  keyword()
) :: String.t()

Renders a mind map to a Mermaid flowchart string.

Options

  • :theme:default, :dark, :warm, :forest, :ocean, or a Choreo.Theme struct
  • :direction:td (default), :lr, :bt, :rl
  • :highlighted_nodes — list of node IDs to highlight
  • :highlighted_edges — list of {from, to} tuples to highlight
  • Any other option accepted by Yog.Multi.Mermaid.to_mermaid/2

Examples

iex> map = Choreo.MindMap.new()
iex> map = map
...>   |> Choreo.MindMap.set_root(:ideas, label: "Ideas")
...>   |> Choreo.MindMap.add_topic(:topic_a, label: "Topic A")
...>   |> Choreo.MindMap.add_subtopic(:sub_a, label: "Sub A")
...>   |> Choreo.MindMap.branch(:ideas, :topic_a)
...>   |> Choreo.MindMap.branch(:topic_a, :sub_a)
iex> mermaid = Choreo.MindMap.Render.Mermaid.to_mermaid(map)
iex> String.contains?(mermaid, "graph TD")
true
iex> String.contains?(mermaid, "Ideas")
true
iex> String.contains?(mermaid, "Topic A")
true