Artefact.Mermaid (Artefact v0.1.5)

Copy Markdown View Source

Derives Mermaid diagram source from an %Artefact{}.

Uses the legacy graph syntax for broad renderer compatibility (GitHub, Notion, mdBook, Livebook). Nodes render as circles (id(("..."))) — the property-graph convention, and a closer match to the vis-network ellipses in the ArtefactKino heartside panel. Labels mirror that panel: the name property (or node id, when no name is set) on top, semantic labels joined with a space below, separated by <br/>.

When artefact.title is set, a YAML front-matter block carries the title (rendered as a heading by Mermaid 9.4+) and an accTitle: line is emitted for screen readers. A nil title produces neither — the export starts at graph <direction>.

When artefact.description is set, an accDescr: line follows the accTitle: line. Multi-line descriptions use the block form (accDescr { ... }); single-line descriptions use the inline form. A nil description is omitted. Like accTitle, the description is screen-reader only — Mermaid does not render it visually.

Lossy: position, style, properties beyond name, and the artefact-level base_label (collapsed into per-node labels at output time) are not represented.

Summary

Functions

Emit a Mermaid source string for the artefact.

Functions

export(artefact, opts \\ [])

Emit a Mermaid source string for the artefact.

Options

  • :direction — flow direction. One of :LR, :RL, :TB, :BT, :TD. Defaults to :LR.

Example

For the us_two artefact:

---
title: UsTwo
---
graph LR
  accTitle: UsTwo
  n0(("Matt<br/>Agent Me"))
  n1(("Claude<br/>Agent You"))
  n0 -->|US_TWO| n1