# `Yarnspinnex.Mermaid`
[🔗](https://github.com/atavistock/yarnspinnex/blob/main/lib/yarnspinnex/mermaid.ex#L1)

Renders a compiled script as Mermaid flowchart source: `node_graph/1` draws one box per node
with an edge per `<<jump>>`, and `flowchart/2` draws every line, choice, and branch inside
each node with edges following control flow between them.

# `expression_text`

```elixir
@spec expression_text(Yarnspinnex.Parser.Expression.ast()) :: String.t()
```

Renders an expression AST back to Yarn source text.

# `flowchart`

```elixir
@spec flowchart(Yarnspinnex.Script.t(), [{:nodes, [String.t()]}]) :: String.t()
```

Every statement drawn inside a subgraph per node. Consecutive lines, sets, and commands share
one box; options and `<<if>>` fan out on labeled edges; `<<stop>>` and the end of a node lead
to a shared terminal. Pass `nodes: [titles]` to draw only those nodes, with jumps out of the
set landing on a plain box for the target.

# `node_graph`

```elixir
@spec node_graph(Yarnspinnex.Script.t()) :: String.t()
```

One box per node, one edge per jump, the start node drawn as a stadium.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
