durian-hypermediaStyle

All fixtures · Hand-written · every-syntax.dh.md

1 problem(s) parse() reported
Source
---
title: "DurianMarkdown: every syntax on one page"
description: Every public sample of the package (v0.7.0-rc.3), 111 in all, each with its source under it.
roles:
  client: c1
  server: c2
  store: c3
  job: c4
  cache: c5
  ops: c6
  plain: c0
marks:
  deprecated:
    label: deprecated
    colour: warn
    means: still works, but will be removed
  experimental:
    label: experimental
    colour: c3
    means: may change without notice
prefixes:
  ">>>":
    label: Python
    colour: c4
    means: a line typed at the Python prompt
---

Every public sample of the package on one page: 111 samples in four groups. Open "Source" under any sample to see what was written.
# Text, blocks and parts


# Fishbone — find the causes

Group possible causes around one effect, then reveal the next finding. Try the step controls, or compare the finished static drawing below. The theme buttons apply to both.

```fishbone title="Why is checkout slow?"
effect: Checkout takes 4 seconds at p95
@step Start with the service
Tools: the ORM loads every line item
  one query per line
Process: no load test before a release
@step Check the surroundings
Environment: the database is in another region
People: on-call is new to the service
highlight Tools
```

## The same diagram, ready to print

```fishbone static title="Why is checkout slow?"
effect: Checkout takes 4 seconds at p95
Tools: the ORM loads every line item
  one query per line
Process: no load test before a release
Environment: the database is in another region
People: on-call is new to the service
highlight Tools
```

:::accordion
#### Source: `fixtures/format/00-fishbone.dh.md`
````text
---
title: Fishbone — find the causes
---

# Fishbone — find the causes

Group possible causes around one effect, then reveal the next finding. Try the step controls, or compare the finished static drawing below. The theme buttons apply to both.

```fishbone title="Why is checkout slow?"
effect: Checkout takes 4 seconds at p95
@step Start with the service
Tools: the ORM loads every line item
  one query per line
Process: no load test before a release
@step Check the surroundings
Environment: the database is in another region
People: on-call is new to the service
highlight Tools
```

## The same diagram, ready to print

```fishbone static title="Why is checkout slow?"
effect: Checkout takes 4 seconds at p95
Tools: the ORM loads every line item
  one query per line
Process: no load test before a release
Environment: the database is in another region
People: on-call is new to the service
highlight Tools
```
````
:::


# Sankey — follow the flow

Follow a request's time through the service. Band widths show milliseconds; hover, focus or tap a band to read its share. Full labels stay on plates in either theme.

```sankey title="Where a request's time goes" unit=ms
request -> auth: 12
request -> handler: 80
node request "Incoming request" [c1]
node auth "Authentication" [c2]
node handler "Application processing" [c3]
node db "Database queries" [c4]
node render "Response assembly" [c5]
node cache "Cache lookup" [c6]
@step Enter the service
@step Follow the work
handler -> db: 55
handler -> render: 20
handler -> cache: 5
```

## The same flow, ready to print

```sankey static title="Where a request's time goes" unit=ms
request -> auth: 12
request -> handler: 80
handler -> db: 55
handler -> render: 20
handler -> cache: 5
node request "Incoming request" [c1]
node auth "Authentication" [c2]
node handler "Application processing" [c3]
node db "Database queries" [c4]
node render "Response assembly" [c5]
node cache "Cache lookup" [c6]
```

:::accordion
#### Source: `fixtures/format/00-sankey.dh.md`
````text
---
title: Sankey — follow the flow
---

# Sankey — follow the flow

Follow a request's time through the service. Band widths show milliseconds; hover, focus or tap a band to read its share. Full labels stay on plates in either theme.

```sankey title="Where a request's time goes" unit=ms
request -> auth: 12
request -> handler: 80
node request "Incoming request" [c1]
node auth "Authentication" [c2]
node handler "Application processing" [c3]
node db "Database queries" [c4]
node render "Response assembly" [c5]
node cache "Cache lookup" [c6]
@step Enter the service
@step Follow the work
handler -> db: 55
handler -> render: 20
handler -> cache: 5
```

## The same flow, ready to print

```sankey static title="Where a request's time goes" unit=ms
request -> auth: 12
request -> handler: 80
handler -> db: 55
handler -> render: 20
handler -> cache: 5
node request "Incoming request" [c1]
node auth "Authentication" [c2]
node handler "Application processing" [c3]
node db "Database queries" [c4]
node render "Response assembly" [c5]
node cache "Cache lookup" [c6]
```
````
:::


## Callouts

A callout is a note beside the text it is about. A note about the whole page is a callout too: put it under the title. It is a blockquote that opens with a bold marker. The marker picks the icon and the colour; the author never picks an icon.

> **Note:** a fact worth knowing, but not needed to follow the text.

> **Tip:** press :kbd[Ctrl+K] to search the docs.

> **Important:** the CLI sends every answer on every call.

> **Watch out:** a validate call replays the script with the deterministic state from before the question.

> **Security finding:** (an example, not a real finding) a security block sits on its own; the public LLM view drops it.

:::accordion
#### Source: `fixtures/format/01-callouts.dh.md`
````text
---
title: "Callouts"
description: A fixture made from the Format page section of the same name.
---

## Callouts

A callout is a note beside the text it is about. A note about the whole page is a callout too: put it under the title. It is a blockquote that opens with a bold marker. The marker picks the icon and the colour; the author never picks an icon.

> **Note:** a fact worth knowing, but not needed to follow the text.

> **Tip:** press :kbd[Ctrl+K] to search the docs.

> **Important:** the CLI sends every answer on every call.

> **Watch out:** a validate call replays the script with the deterministic state from before the question.

> **Security finding:** (an example, not a real finding) a security block sits on its own; the public LLM view drops it.
````
:::


## Keyboard keys

One key :kbd[Esc], a combination :kbd[Ctrl+Shift+P], and a sequence :kbd[Ctrl+K, Ctrl+S]: press the first, let go, then press the second.
Arrow keys are written by name: :kbd[Left] and :kbd[Right] step through a stage; the page draws the arrows.

:::accordion
#### Source: `fixtures/format/02-keyboard-keys.dh.md`
````text
---
title: "Keyboard keys"
description: A fixture made from the Format page section of the same name.
---

## Keyboard keys

One key :kbd[Esc], a combination :kbd[Ctrl+Shift+P], and a sequence :kbd[Ctrl+K, Ctrl+S]: press the first, let go, then press the second.
Arrow keys are written by name: :kbd[Left] and :kbd[Right] step through a stage; the page draws the arrows.
````
:::


## Mouse actions

One mouse icon and the action. The button the action presses is filled: the left one for a click, the right one for a right click, the wheel for a middle click. A double click adds a "2", so it never looks like a single click. Scroll adds arrows by the wheel; drag, drop, hover and select add their own small mark.

- :mouse[click Next]
- :mouse[double-click index.ts]
- :mouse[right-click src/]
- :mouse[middle-click the tab]
- :mouse[scroll the list]
- :mouse[drag README.md]
- :mouse[drop it on docs/]
- :mouse[hover the chip]
- :mouse[select the first line]

:::accordion
#### Source: `fixtures/format/03-mouse-actions.dh.md`
````text
---
title: "Mouse actions"
description: A fixture made from the Format page section of the same name.
---

## Mouse actions

One mouse icon and the action. The button the action presses is filled: the left one for a click, the right one for a right click, the wheel for a middle click. A double click adds a "2", so it never looks like a single click. Scroll adds arrows by the wheel; drag, drop, hover and select add their own small mark.

- :mouse[click Next]
- :mouse[double-click index.ts]
- :mouse[right-click src/]
- :mouse[middle-click the tab]
- :mouse[scroll the list]
- :mouse[drag README.md]
- :mouse[drop it on docs/]
- :mouse[hover the chip]
- :mouse[select the first line]
````
:::


## Table of contents

The page form lists the page's headings; `depth` says how deep it goes.

::toc{depth=2}

:::accordion
#### Source: `fixtures/format/04-table-of-contents.dh.md`
````text
---
title: "Table of contents"
description: A fixture made from the Format page section of the same name.
---

## Table of contents

The page form lists the page's headings; `depth` says how deep it goes.

::toc{depth=2}
````
:::


## Tabs

Each heading inside `:::tabs` starts one tab. An LLM reads the headings and the text under them.

:::tabs
#### Node
Install with `npm i @example/scaffold-sdk`.
#### Python
Install with `pip install scaffold-sdk`.
:::

:::accordion
#### Source: `fixtures/format/05-tabs.dh.md`
````text
---
title: "Tabs"
description: A fixture made from the Format page section of the same name.
---

## Tabs

Each heading inside `:::tabs` starts one tab. An LLM reads the headings and the text under them.

:::tabs
#### Node
Install with `npm i @example/scaffold-sdk`.
#### Python
Install with `pip install scaffold-sdk`.
:::
````
:::


## Accordion

Each heading inside `:::accordion` starts one row that opens and closes.

:::accordion
#### Why replay instead of pausing?
A paused script would tie one template container to each person who is answering.
#### What does a replay cost?
Each call runs the script again from its first line.
:::

:::accordion
#### Source: `fixtures/format/06-accordion.dh.md`
````text
---
title: "Accordion"
description: A fixture made from the Format page section of the same name.
---

## Accordion

Each heading inside `:::accordion` starts one row that opens and closes.

:::accordion
#### Why replay instead of pausing?
A paused script would tie one template container to each person who is answering.
#### What does a replay cost?
Each call runs the script again from its first line.
:::
````
:::


## Human-only segment

A segment for people only. The `:::llm` block right after it is what an LLM reads instead.

:::human
This segment is long on purpose: it walks a new reader through the idea, slowly, with a picture.

```animation
person p "person"
box c "CLI"
box t "template container"
p -> c "talks to"
c -> t "calls"
```
:::

:::llm
The person talks to the CLI, which calls the template container.
:::

:::accordion
#### Source: `fixtures/format/07-human-only-segment.dh.md`
````text
---
title: "Human-only segment"
description: A fixture made from the Format page section of the same name.
---

## Human-only segment

A segment for people only. The `:::llm` block right after it is what an LLM reads instead.

:::human
This segment is long on purpose: it walks a new reader through the idea, slowly, with a picture.

```animation
person p "person"
box c "CLI"
box t "template container"
p -> c "talks to"
c -> t "calls"
```
:::

:::llm
The person talks to the CLI, which calls the template container.
:::
````
:::


## A segment LLMs skip

`llm=none` says, in the source, that LLMs need nothing here.

:::human llm=none
Use :kbd[Left] and :kbd[Right] to step through a stage.
:::

:::accordion
#### Source: `fixtures/format/08-a-segment-llms-skip.dh.md`
````text
---
title: "A segment LLMs skip"
description: A fixture made from the Format page section of the same name.
---

## A segment LLMs skip

`llm=none` says, in the source, that LLMs need nothing here.

:::human llm=none
Use :kbd[Left] and :kbd[Right] to step through a stage.
:::
````
:::


## Still scene

Boxes joined by lines are an `animation`. With no `@step` line it stands still: drawn once, with no player. An LLM reads what it starts with and what is connected.

```animation
box cli "CLI"
box tc "template container"
cli -> tc "init call"
box out "project folder"
tc -> out "writes the files"
```

:::accordion
#### Source: `fixtures/format/09-still-scene.dh.md`
````text
---
title: "Still scene"
description: A fixture made from the Format page section of the same name.
---

## Still scene

Boxes joined by lines are an `animation`. With no `@step` line it stands still: drawn once, with no player. An LLM reads what it starts with and what is connected.

```animation
box cli "CLI"
box tc "template container"
cli -> tc "init call"
box out "project folder"
tc -> out "writes the files"
```
````
:::


## Steps on any part

Steps are not a part of their own: any part becomes step by step when it holds `@step` lines. Here a sequence builds up one call a step.

```sequence
participant cli "CLI"
participant tc "template container"
@step The CLI sends an init call with every answer it holds.
cli -> tc: init call: all answers
@step The script stops at a question and sends it back.
tc --> cli: question reply
@step The next init call carries one answer more.
cli -> tc: init call: one more answer
```

:::accordion
#### Source: `fixtures/format/10-steps-on-any-part.dh.md`
````text
---
title: "Steps on any part"
description: A fixture made from the Format page section of the same name.
---

## Steps on any part

Steps are not a part of their own: any part becomes step by step when it holds `@step` lines. Here a sequence builds up one call a step.

```sequence
participant cli "CLI"
participant tc "template container"
@step The CLI sends an init call with every answer it holds.
cli -> tc: init call: all answers
@step The script stops at a question and sends it back.
tc --> cli: question reply
@step The next init call carries one answer more.
cli -> tc: init call: one more answer
```
````
:::


## Chart: bar

An LLM reads a chart's data as a table.

```chart
kind: bar
title: Answers carried by each init call
x: { label: init call, values: [1, 2, 3, 4, 5] }
y: { label: answers }
series:
  - name: answers
    data: [0, 1, 2, 3, 4]
```

:::accordion
#### Source: `fixtures/format/11-chart-bar.dh.md`
````text
---
title: "Chart: bar"
description: A fixture made from the Format page section of the same name.
---

## Chart: bar

An LLM reads a chart's data as a table.

```chart
kind: bar
title: Answers carried by each init call
x: { label: init call, values: [1, 2, 3, 4, 5] }
y: { label: answers }
series:
  - name: answers
    data: [0, 1, 2, 3, 4]
```
````
:::


## Chart: grouped bars

Several series side by side is the default for bars.

```chart
kind: bar
title: Runs per create, by number of questions
x: { label: questions, values: [2, 4, 6] }
y: { label: runs }
series:
  - name: init calls
    data: [3, 5, 7]
  - name: validate calls
    data: [2, 4, 6]
  - name: both
    data: [5, 9, 13]
```

:::accordion
#### Source: `fixtures/format/12-chart-grouped-bars.dh.md`
````text
---
title: "Chart: grouped bars"
description: A fixture made from the Format page section of the same name.
---

## Chart: grouped bars

Several series side by side is the default for bars.

```chart
kind: bar
title: Runs per create, by number of questions
x: { label: questions, values: [2, 4, 6] }
y: { label: runs }
series:
  - name: init calls
    data: [3, 5, 7]
  - name: validate calls
    data: [2, 4, 6]
  - name: both
    data: [5, 9, 13]
```
````
:::


## Chart: stacked bar

```chart
kind: bar
stacked: true
title: Size of each init call, in bytes
x: { label: init call, values: [1, 2, 3, 4] }
y: { label: bytes }
series:
  - name: answers
    data: [0, 48, 96, 144]
  - name: deterministic state
    data: [0, 40, 40, 40]
```

:::accordion
#### Source: `fixtures/format/13-chart-stacked-bar.dh.md`
````text
---
title: "Chart: stacked bar"
description: A fixture made from the Format page section of the same name.
---

## Chart: stacked bar

```chart
kind: bar
stacked: true
title: Size of each init call, in bytes
x: { label: init call, values: [1, 2, 3, 4] }
y: { label: bytes }
series:
  - name: answers
    data: [0, 48, 96, 144]
  - name: deterministic state
    data: [0, 40, 40, 40]
```
````
:::


## Chart: 100% stacked bar

`stacked: percent` scales each bar to 100%; the tooltip still shows the real number. Init call 1 carries nothing, so it has no share and is left out.

```chart
kind: bar
stacked: percent
title: Share of each init call's size
x: { label: init call, values: [2, 3, 4] }
y: { label: share of bytes }
series:
  - name: answers
    data: [48, 96, 144]
  - name: deterministic state
    data: [40, 40, 40]
```

:::accordion
#### Source: `fixtures/format/14-chart-100-stacked-bar.dh.md`
````text
---
title: "Chart: 100% stacked bar"
description: A fixture made from the Format page section of the same name.
---

## Chart: 100% stacked bar

`stacked: percent` scales each bar to 100%; the tooltip still shows the real number. Init call 1 carries nothing, so it has no share and is left out.

```chart
kind: bar
stacked: percent
title: Share of each init call's size
x: { label: init call, values: [2, 3, 4] }
y: { label: share of bytes }
series:
  - name: answers
    data: [48, 96, 144]
  - name: deterministic state
    data: [40, 40, 40]
```
````
:::


## Chart: horizontal bar

`horizontal: true` turns the bars on their side; long names get room.

```chart
kind: bar
horizontal: true
title: Time to create, by way of working
x: { label: way, values: [Edit files by hand, Run the template once, Ask every question, Replay all answers] }
y: { label: seconds }
series:
  - name: seconds
    data: [95, 12, 31, 48]
```

:::accordion
#### Source: `fixtures/format/15-chart-horizontal-bar.dh.md`
````text
---
title: "Chart: horizontal bar"
description: A fixture made from the Format page section of the same name.
---

## Chart: horizontal bar

`horizontal: true` turns the bars on their side; long names get room.

```chart
kind: bar
horizontal: true
title: Time to create, by way of working
x: { label: way, values: [Edit files by hand, Run the template once, Ask every question, Replay all answers] }
y: { label: seconds }
series:
  - name: seconds
    data: [95, 12, 31, 48]
```
````
:::


## Chart: floating bars

A value written `[low, high]` floats the bar between the two. The LLM table reads it as "3 to 9".

```chart
kind: bar
title: Time each step takes, in seconds
x: { label: step, values: [Ask, Validate, Generate, Write] }
y: { label: seconds }
series:
  - name: range
    data: [[0, 4], [4, 9], [9, 21], [21, 26]]
```

:::accordion
#### Source: `fixtures/format/16-chart-floating-bars.dh.md`
````text
---
title: "Chart: floating bars"
description: A fixture made from the Format page section of the same name.
---

## Chart: floating bars

A value written `[low, high]` floats the bar between the two. The LLM table reads it as "3 to 9".

```chart
kind: bar
title: Time each step takes, in seconds
x: { label: step, values: [Ask, Validate, Generate, Write] }
y: { label: seconds }
series:
  - name: range
    data: [[0, 4], [4, 9], [9, 21], [21, 26]]
```
````
:::


## Chart: line

```chart
kind: line
title: Script runs per create, by number of questions
x: { label: questions, values: [1, 2, 3, 4, 5, 6] }
y: { label: runs }
series:
  - name: init calls
    data: [2, 3, 4, 5, 6, 7]
  - name: with one validate call per question
    data: [3, 5, 7, 9, 11, 13]
```

:::accordion
#### Source: `fixtures/format/17-chart-line.dh.md`
````text
---
title: "Chart: line"
description: A fixture made from the Format page section of the same name.
---

## Chart: line

```chart
kind: line
title: Script runs per create, by number of questions
x: { label: questions, values: [1, 2, 3, 4, 5, 6] }
y: { label: runs }
series:
  - name: init calls
    data: [2, 3, 4, 5, 6, 7]
  - name: with one validate call per question
    data: [3, 5, 7, 9, 11, 13]
```
````
:::


## Chart: area

```chart
kind: area
title: Answers sent in all, after each init call
x: { label: init call, values: [1, 2, 3, 4, 5, 6] }
y: { label: answers sent so far }
series:
  - name: answers sent
    data: [0, 1, 3, 6, 10, 15]
```

:::accordion
#### Source: `fixtures/format/18-chart-area.dh.md`
````text
---
title: "Chart: area"
description: A fixture made from the Format page section of the same name.
---

## Chart: area

```chart
kind: area
title: Answers sent in all, after each init call
x: { label: init call, values: [1, 2, 3, 4, 5, 6] }
y: { label: answers sent so far }
series:
  - name: answers sent
    data: [0, 1, 3, 6, 10, 15]
```
````
:::


## Chart: stacked area

```chart
kind: area
stacked: true
title: Calls sent so far, by kind
x: { label: init call, values: [1, 2, 3, 4, 5] }
y: { label: calls }
series:
  - name: init calls
    data: [1, 2, 3, 4, 5]
  - name: validate calls
    data: [0, 1, 2, 3, 4]
```

:::accordion
#### Source: `fixtures/format/19-chart-stacked-area.dh.md`
````text
---
title: "Chart: stacked area"
description: A fixture made from the Format page section of the same name.
---

## Chart: stacked area

```chart
kind: area
stacked: true
title: Calls sent so far, by kind
x: { label: init call, values: [1, 2, 3, 4, 5] }
y: { label: calls }
series:
  - name: init calls
    data: [1, 2, 3, 4, 5]
  - name: validate calls
    data: [0, 1, 2, 3, 4]
```
````
:::


## Chart: mixed bars and line, two axes

A series can have its own `kind`, and `axis: y2` puts it on a second axis on the right. The chart declares that axis with `y2`.

```chart
kind: bar
title: Runs and time, by number of questions
x: { label: questions, values: [1, 2, 3, 4, 5] }
y: { label: runs }
y2: { label: seconds, min: 0 }
series:
  - name: runs
    data: [2, 3, 4, 5, 6]
  - name: time
    kind: line
    axis: y2
    tone: 5
    data: [4, 7, 11, 16, 22]
```

:::accordion
#### Source: `fixtures/format/20-chart-mixed-bars-and-line-two-axes.dh.md`
````text
---
title: "Chart: mixed bars and line, two axes"
description: A fixture made from the Format page section of the same name.
---

## Chart: mixed bars and line, two axes

A series can have its own `kind`, and `axis: y2` puts it on a second axis on the right. The chart declares that axis with `y2`.

```chart
kind: bar
title: Runs and time, by number of questions
x: { label: questions, values: [1, 2, 3, 4, 5] }
y: { label: runs }
y2: { label: seconds, min: 0 }
series:
  - name: runs
    data: [2, 3, 4, 5, 6]
  - name: time
    kind: line
    axis: y2
    tone: 5
    data: [4, 7, 11, 16, 22]
```
````
:::


## Chart: log scale

`scale: log` on an axis spaces the ticks by powers of ten. It needs values above 0.

```chart
kind: line
title: Size of the answer set, by number of questions
x: { label: questions, values: [1, 2, 3, 4, 5, 6] }
y: { label: possible answer sets, scale: log }
series:
  - name: answer sets
    data: [3, 9, 27, 81, 243, 729]
```

:::accordion
#### Source: `fixtures/format/21-chart-log-scale.dh.md`
````text
---
title: "Chart: log scale"
description: A fixture made from the Format page section of the same name.
---

## Chart: log scale

`scale: log` on an axis spaces the ticks by powers of ten. It needs values above 0.

```chart
kind: line
title: Size of the answer set, by number of questions
x: { label: questions, values: [1, 2, 3, 4, 5, 6] }
y: { label: possible answer sets, scale: log }
series:
  - name: answer sets
    data: [3, 9, 27, 81, 243, 729]
```
````
:::


## Chart: scatter

```chart
kind: scatter
title: Body size against answers carried
x: { label: answers }
y: { label: bytes }
series:
  - name: init calls
    data: [[0, 40], [1, 92], [2, 139], [3, 190], [4, 236], [5, 288]]
```

:::accordion
#### Source: `fixtures/format/22-chart-scatter.dh.md`
````text
---
title: "Chart: scatter"
description: A fixture made from the Format page section of the same name.
---

## Chart: scatter

```chart
kind: scatter
title: Body size against answers carried
x: { label: answers }
y: { label: bytes }
series:
  - name: init calls
    data: [[0, 40], [1, 92], [2, 139], [3, 190], [4, 236], [5, 288]]
```
````
:::


## Chart: scatter on log scales

Both axes of a scatter chart can be log.

```chart
kind: scatter
title: Run time against input size
x: { label: questions, scale: log }
y: { label: milliseconds, scale: log }
series:
  - name: runs
    data: [[1, 12], [3, 35], [10, 120], [30, 340], [100, 1200], [300, 3500]]
```

:::accordion
#### Source: `fixtures/format/23-chart-scatter-on-log-scales.dh.md`
````text
---
title: "Chart: scatter on log scales"
description: A fixture made from the Format page section of the same name.
---

## Chart: scatter on log scales

Both axes of a scatter chart can be log.

```chart
kind: scatter
title: Run time against input size
x: { label: questions, scale: log }
y: { label: milliseconds, scale: log }
series:
  - name: runs
    data: [[1, 12], [3, 35], [10, 120], [30, 340], [100, 1200], [300, 3500]]
```
````
:::


## Chart: bubble

A bubble point is `[x, y, size]`; the area of the bubble follows the size.

```chart
kind: bubble
title: Templates by questions, run time and downloads
x: { label: questions }
y: { label: seconds }
series:
  - name: templates
    data: [[3, 8, 120], [6, 14, 480], [9, 30, 60], [12, 41, 900], [15, 52, 240]]
```

:::accordion
#### Source: `fixtures/format/24-chart-bubble.dh.md`
````text
---
title: "Chart: bubble"
description: A fixture made from the Format page section of the same name.
---

## Chart: bubble

A bubble point is `[x, y, size]`; the area of the bubble follows the size.

```chart
kind: bubble
title: Templates by questions, run time and downloads
x: { label: questions }
y: { label: seconds }
series:
  - name: templates
    data: [[3, 8, 120], [6, 14, 480], [9, 30, 60], [12, 41, 900], [15, 52, 240]]
```
````
:::


## Chart: candlestick

A candlestick chart draws one candle per period. Its series has no `kind`, and each value is four numbers, `[open, high, low, close]`. The body runs from the open to the close and the thin line (the wick) from the low to the high. A candle that closes at or above its open is up (green, light body); one that closes below is down (pink, solid body). Hover or tap a candle to read all four numbers.

```chart
kind: candlestick
title: One week of a share price
x: { label: day, values: [Mon, Tue, Wed, Thu, Fri] }
y: { label: price, min: 90 }
series:
  - name: price
    data: [[100, 108, 98, 105], [105, 110, 101, 102], [102, 104, 95, 96], [96, 103, 94, 101], [101, 109, 100, 108]]
```

:::accordion
#### Source: `fixtures/format/25-chart-candlestick.dh.md`
````text
---
title: "Chart: candlestick"
description: A fixture made from the Format page section of the same name.
---

## Chart: candlestick

A candlestick chart draws one candle per period. Its series has no `kind`, and each value is four numbers, `[open, high, low, close]`. The body runs from the open to the close and the thin line (the wick) from the low to the high. A candle that closes at or above its open is up (green, light body); one that closes below is down (pink, solid body). Hover or tap a candle to read all four numbers.

```chart
kind: candlestick
title: One week of a share price
x: { label: day, values: [Mon, Tue, Wed, Thu, Fri] }
y: { label: price, min: 90 }
series:
  - name: price
    data: [[100, 108, 98, 105], [105, 110, 101, 102], [102, 104, 95, 96], [96, 103, 94, 101], [101, 109, 100, 108]]
```
````
:::


## Chart: candlestick with a moving average

Another series with `kind: line` draws on top of the candles: here the average of the last three closing prices. It may use `y2` for a second axis, like any other chart.

```chart
kind: candlestick
title: Two weeks of a share price, with its 3-day average
x: { label: day, values: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] }
y: { label: price, min: 90 }
series:
  - name: price
    data: [[100, 106, 98, 104], [104, 109, 102, 107], [107, 111, 105, 106], [106, 108, 101, 102], [102, 105, 97, 99], [99, 104, 96, 103], [103, 110, 102, 109], [109, 113, 107, 112], [112, 114, 108, 109], [109, 112, 106, 111]]
  - name: 3-day average
    kind: line
    tone: 6
    data: [null, null, 105.7, 105, 102.3, 101.3, 103.7, 108, 110, 110.7]
```

:::accordion
#### Source: `fixtures/format/26-chart-candlestick-with-a-moving-average.dh.md`
````text
---
title: "Chart: candlestick with a moving average"
description: A fixture made from the Format page section of the same name.
---

## Chart: candlestick with a moving average

Another series with `kind: line` draws on top of the candles: here the average of the last three closing prices. It may use `y2` for a second axis, like any other chart.

```chart
kind: candlestick
title: Two weeks of a share price, with its 3-day average
x: { label: day, values: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] }
y: { label: price, min: 90 }
series:
  - name: price
    data: [[100, 106, 98, 104], [104, 109, 102, 107], [107, 111, 105, 106], [106, 108, 101, 102], [102, 105, 97, 99], [99, 104, 96, 103], [103, 110, 102, 109], [109, 113, 107, 112], [112, 114, 108, 109], [109, 112, 106, 111]]
  - name: 3-day average
    kind: line
    tone: 6
    data: [null, null, 105.7, 105, 102.3, 101.3, 103.7, 108, 110, 110.7]
```
````
:::


## Chart: radar

The x list names the axes (at least three); each series is one outline.

```chart
kind: radar
title: Two ways of replaying answers
x: [Speed, Safety, Size, Clarity, Cost]
series:
  - name: Replay all answers
    data: [3, 5, 2, 4, 4]
  - name: Keep a session
    data: [5, 2, 4, 3, 2]
```

:::accordion
#### Source: `fixtures/format/27-chart-radar.dh.md`
````text
---
title: "Chart: radar"
description: A fixture made from the Format page section of the same name.
---

## Chart: radar

The x list names the axes (at least three); each series is one outline.

```chart
kind: radar
title: Two ways of replaying answers
x: [Speed, Safety, Size, Clarity, Cost]
series:
  - name: Replay all answers
    data: [3, 5, 2, 4, 4]
  - name: Keep a session
    data: [5, 2, 4, 3, 2]
```
````
:::


## Chart: pie

```chart
kind: pie
title: Time in one create
x: { values: [Ask, Validate, Generate, Write] }
series:
  - name: seconds
    data: [4, 5, 12, 5]
```

:::accordion
#### Source: `fixtures/format/28-chart-pie.dh.md`
````text
---
title: "Chart: pie"
description: A fixture made from the Format page section of the same name.
---

## Chart: pie

```chart
kind: pie
title: Time in one create
x: { values: [Ask, Validate, Generate, Write] }
series:
  - name: seconds
    data: [4, 5, 12, 5]
```
````
:::


## Chart: doughnut

```chart
kind: doughnut
title: Where the script's runs go, for 3 questions
x: { values: [init calls, validate calls] }
series:
  - name: runs
    data: [4, 2]
```

:::accordion
#### Source: `fixtures/format/29-chart-doughnut.dh.md`
````text
---
title: "Chart: doughnut"
description: A fixture made from the Format page section of the same name.
---

## Chart: doughnut

```chart
kind: doughnut
title: Where the script's runs go, for 3 questions
x: { values: [init calls, validate calls] }
series:
  - name: runs
    data: [4, 2]
```
````
:::


## Chart: polar area

Like a pie, but every slice has the same angle and its value is the length.

```chart
kind: polar
title: Calls by hour of the day
x: { values: [Morning, Noon, Afternoon, Evening, Night] }
series:
  - name: calls
    data: [34, 52, 61, 28, 9]
```

:::accordion
#### Source: `fixtures/format/30-chart-polar-area.dh.md`
````text
---
title: "Chart: polar area"
description: A fixture made from the Format page section of the same name.
---

## Chart: polar area

Like a pie, but every slice has the same angle and its value is the length.

```chart
kind: polar
title: Calls by hour of the day
x: { values: [Morning, Noon, Afternoon, Evening, Night] }
series:
  - name: calls
    data: [34, 52, 61, 28, 9]
```
````
:::


## Chart with controls

The reader moves the slider or picks a view; the chart redraws from its formulas. A chart with formulas goes to an LLM as its source, since the formulas say more than one set of numbers.

```chart
kind: bar
title: Answers carried by each init call
controls:
  - slider: questions
    label: Questions in the script
    min: 1
    max: 20
    value: 6
  - select: view
    label: Show
    options: [per call, running total]
let:
  calls: range(1, questions + 1)
  carried: calls - 1
x: calls
y: { label: answers }
series:
  - name: answers
    data: "view == 'per call' ? carried : cumsum(carried)"
```

:::accordion
#### Source: `fixtures/format/31-chart-with-controls.dh.md`
````text
---
title: "Chart with controls"
description: A fixture made from the Format page section of the same name.
---

## Chart with controls

The reader moves the slider or picks a view; the chart redraws from its formulas. A chart with formulas goes to an LLM as its source, since the formulas say more than one set of numbers.

```chart
kind: bar
title: Answers carried by each init call
controls:
  - slider: questions
    label: Questions in the script
    min: 1
    max: 20
    value: 6
  - select: view
    label: Show
    options: [per call, running total]
let:
  calls: range(1, questions + 1)
  carried: calls - 1
x: calls
y: { label: answers }
series:
  - name: answers
    data: "view == 'per call' ? carried : cumsum(carried)"
```
````
:::


## Tier list

A tier list ranks items in rows, best first. Write one line per tier: its name, a colon, then its items with commas between them. A short note goes in brackets after an item; the page shows it when a reader taps or hovers the item. An LLM reads the same lines.

```tierlist title="Databases for a small team"
S: Postgres (does almost everything), SQLite (no server to run)
A: MySQL, "Redis, as a cache" (fast, but memory is dear)
B: MongoDB, DynamoDB
C: Cassandra (great at scale, hard to run small)
D: A spreadsheet
```

:::accordion
#### Source: `fixtures/format/32-tier-list.dh.md`
````text
---
title: "Tier list"
description: A fixture made from the Format page section of the same name.
---

## Tier list

A tier list ranks items in rows, best first. Write one line per tier: its name, a colon, then its items with commas between them. A short note goes in brackets after an item; the page shows it when a reader taps or hovers the item. An LLM reads the same lines.

```tierlist title="Databases for a small team"
S: Postgres (does almost everything), SQLite (no server to run)
A: MySQL, "Redis, as a cache" (fast, but memory is dear)
B: MongoDB, DynamoDB
C: Cassandra (great at scale, hard to run small)
D: A spreadsheet
```
````
:::


## Tier list: your own tiers

The tiers are S, A, B, C and D unless you say otherwise. **A list may have any tiers, in any number.** Start with a line `tiers:` that names them; a name may be followed by a colour in square brackets (`c1` to `c8`, `good`, `warn` or `bad`). The tier lines use those names; a tier with no line is an empty row. This list has four tiers.

```tierlist title="What the first release needs"
tiers: Must [good], Should [c6], Could [c3], Won't [bad]
Must: Sign in, Pay by card (one provider)
Should: Email receipts, A dark theme
Could: Gift cards (needs a legal check)
Won't: A mobile app
```

:::accordion
#### Source: `fixtures/format/33-tier-list-your-own-tiers.dh.md`
````text
---
title: "Tier list: your own tiers"
description: A fixture made from the Format page section of the same name.
---

## Tier list: your own tiers

The tiers are S, A, B, C and D unless you say otherwise. **A list may have any tiers, in any number.** Start with a line `tiers:` that names them; a name may be followed by a colour in square brackets (`c1` to `c8`, `good`, `warn` or `bad`). The tier lines use those names; a tier with no line is an empty row. This list has four tiers.

```tierlist title="What the first release needs"
tiers: Must [good], Should [c6], Could [c3], Won't [bad]
Must: Sign in, Pay by card (one provider)
Should: Email receipts, A dark theme
Could: Gift cards (needs a legal check)
Won't: A mobile app
```
````
:::


## Tier list: three tiers, or seven

There is no limit of four or five. Three tiers are enough for a short list; seven fit a scale with many steps. Only the names on the `tiers:` line count.

```tierlist title="Is it worth doing?"
tiers: Yes [good], Maybe [warn], No [bad]
Yes: Cache the build, Add a sample
Maybe: Rewrite the docs site (a lot of work)
No: Support every browser ever
```

```tierlist title="How far along is each part?"
tiers: Shipped [good], Beta [c6], Alpha [c4], Prototype [c3], Sketch [c5], Idea [c7], Dropped [bad]
Shipped: Terminal, File tree
Beta: Editor
Alpha: Animation in 3D
Prototype: Tier list
Sketch: Voice over
Idea: A map part
Dropped: A clock part
```

:::accordion
#### Source: `fixtures/format/34-tier-list-three-tiers-or-seven.dh.md`
````text
---
title: "Tier list: three tiers, or seven"
description: A fixture made from the Format page section of the same name.
---

## Tier list: three tiers, or seven

There is no limit of four or five. Three tiers are enough for a short list; seven fit a scale with many steps. Only the names on the `tiers:` line count.

```tierlist title="Is it worth doing?"
tiers: Yes [good], Maybe [warn], No [bad]
Yes: Cache the build, Add a sample
Maybe: Rewrite the docs site (a lot of work)
No: Support every browser ever
```

```tierlist title="How far along is each part?"
tiers: Shipped [good], Beta [c6], Alpha [c4], Prototype [c3], Sketch [c5], Idea [c7], Dropped [bad]
Shipped: Terminal, File tree
Beta: Editor
Alpha: Animation in 3D
Prototype: Tier list
Sketch: Voice over
Idea: A map part
Dropped: A clock part
```
````
:::


## Alignment grid

An alignment grid has two axes, each with a name at both ends and any names between (the classic one is lawful .. chaotic by good .. evil). The first name is the left (or top) end. Put items in a cell by its column and row names, `column / row: item, item`; a `"label"` before the colon names the cell.

```alignment title="Which kind of hero?"
x: lawful .. neutral .. chaotic
y: good .. neutral .. evil
lawful / good "Crusader": Paladin (keeps every oath), Cleric
neutral / good: Druid (looks after the land)
chaotic / good "Rebel": Bard (helps, breaks the rules)
neutral / neutral "Balance": Monk
lawful / evil "Tyrant": Warlock (a contract for everything)
chaotic / evil "Raider": Rogue (takes what it wants)
```

:::accordion
#### Source: `fixtures/format/35-alignment-grid.dh.md`
````text
---
title: "Alignment grid"
description: A fixture made from the Format page section of the same name.
---

## Alignment grid

An alignment grid has two axes, each with a name at both ends and any names between (the classic one is lawful .. chaotic by good .. evil). The first name is the left (or top) end. Put items in a cell by its column and row names, `column / row: item, item`; a `"label"` before the colon names the cell.

```alignment title="Which kind of hero?"
x: lawful .. neutral .. chaotic
y: good .. neutral .. evil
lawful / good "Crusader": Paladin (keeps every oath), Cleric
neutral / good: Druid (looks after the land)
chaotic / good "Rebel": Bard (helps, breaks the rules)
neutral / neutral "Balance": Monk
lawful / evil "Tyrant": Warlock (a contract for everything)
chaotic / evil "Raider": Rogue (takes what it wants)
```
````
:::


## Alignment grid: points

An item can sit at a point instead: `item @ x, y`, with x and y from 0 to 1 (0 is the first end of the axis, 1 the last, 0.5 the middle). Cells and points can be mixed; here the cells only carry labels.

```alignment title="Which task first?"
x: low effort .. high effort
y: high impact .. low impact
low effort / high impact "Do first":
high effort / high impact "Plan it":
low effort / low impact "Fill a gap":
high effort / low impact "Skip":
Fix the typo (one line) @ 0.12, 0.22
Add a sample (people copy it) @ 0.32, 0.3
Speed up the build @ 0.66, 0.2
Rewrite the docs site @ 0.86, 0.62
Rename a variable @ 0.14, 0.78
Move the logo @ 0.4, 0.88
```

:::accordion
#### Source: `fixtures/format/36-alignment-grid-points.dh.md`
````text
---
title: "Alignment grid: points"
description: A fixture made from the Format page section of the same name.
---

## Alignment grid: points

An item can sit at a point instead: `item @ x, y`, with x and y from 0 to 1 (0 is the first end of the axis, 1 the last, 0.5 the middle). Cells and points can be mixed; here the cells only carry labels.

```alignment title="Which task first?"
x: low effort .. high effort
y: high impact .. low impact
low effort / high impact "Do first":
high effort / high impact "Plan it":
low effort / low impact "Fill a gap":
high effort / low impact "Skip":
Fix the typo (one line) @ 0.12, 0.22
Add a sample (people copy it) @ 0.32, 0.3
Speed up the build @ 0.66, 0.2
Rewrite the docs site @ 0.86, 0.62
Rename a variable @ 0.14, 0.78
Move the logo @ 0.4, 0.88
```
````
:::


## Alignment grid: any size

Each axis has 2 to 6 names, and the two axes need not match: this grid has five columns and three rows. A grid with more names than that would have cells too small to read.

```alignment title="How far along is each part?"
x: idea .. sketch .. draft .. review .. shipped
y: small .. medium .. large
idea / small: A clock part
sketch / medium: A map part
draft / medium: Tier list
review / large: Animation in 3D
shipped / small "Done": Terminal
shipped / medium: Editor, File tree
```

:::accordion
#### Source: `fixtures/format/37-alignment-grid-any-size.dh.md`
````text
---
title: "Alignment grid: any size"
description: A fixture made from the Format page section of the same name.
---

## Alignment grid: any size

Each axis has 2 to 6 names, and the two axes need not match: this grid has five columns and three rows. A grid with more names than that would have cells too small to read.

```alignment title="How far along is each part?"
x: idea .. sketch .. draft .. review .. shipped
y: small .. medium .. large
idea / small: A clock part
sketch / medium: A map part
draft / medium: Tier list
review / large: Animation in 3D
shipped / small "Done": Terminal
shipped / medium: Editor, File tree
```
````
:::


## Alignment grid: colours and regions

`[colour]` after a cell's name (and its label) tints that cell. A `region:` line paints a block of cells with a label: write its columns and rows, each one name or `first .. last`. Colours are the theme names `c1` to `c8`, `good`, `warn` and `bad`, never a hex value. `arrows: on` draws an arrow along each axis. A cell's own colour wins over its region's; regions may not overlap.

```alignment title="Where does each task go?"
x: low effort .. medium .. high effort
y: high impact .. medium .. low impact
arrows: on
region: low effort .. medium / high impact .. medium "Quick wins" [good]
region: high effort / low impact "Avoid" [bad]
low effort / high impact "Do first" [c6]: Fix the typo
medium / high impact: Add a sample
low effort / medium: Speed up the build
high effort / high impact: Move to the new CI (needs a plan)
high effort / low impact: Rewrite the docs site
```

:::accordion
#### Source: `fixtures/format/38-alignment-grid-colours-and-regions.dh.md`
````text
---
title: "Alignment grid: colours and regions"
description: A fixture made from the Format page section of the same name.
---

## Alignment grid: colours and regions

`[colour]` after a cell's name (and its label) tints that cell. A `region:` line paints a block of cells with a label: write its columns and rows, each one name or `first .. last`. Colours are the theme names `c1` to `c8`, `good`, `warn` and `bad`, never a hex value. `arrows: on` draws an arrow along each axis. A cell's own colour wins over its region's; regions may not overlap.

```alignment title="Where does each task go?"
x: low effort .. medium .. high effort
y: high impact .. medium .. low impact
arrows: on
region: low effort .. medium / high impact .. medium "Quick wins" [good]
region: high effort / low impact "Avoid" [bad]
low effort / high impact "Do first" [c6]: Fix the typo
medium / high impact: Add a sample
low effort / medium: Speed up the build
high effort / high impact: Move to the new CI (needs a plan)
high effort / low impact: Rewrite the docs site
```
````
:::


## File tree

```filetree
hello-app/
  .scaffold_state.yaml  (new)  # answers, kept for update
  README.md  (generated)
  node_modules/  (closed)
    ...
```

:::accordion
#### Source: `fixtures/format/39-file-tree.dh.md`
````text
---
title: "File tree"
description: A fixture made from the Format page section of the same name.
---

## File tree

```filetree
hello-app/
  .scaffold_state.yaml  (new)  # answers, kept for update
  README.md  (generated)
  node_modules/  (closed)
    ...
```
````
:::


## File tree with steps

```filetree
@step After scaffold create
hello-app/
  .scaffold_state.yaml  (new)  # answers, kept for update
  README.md  (generated)
@step After the user edits it
hello-app/
  .scaffold_state.yaml
  README.md  (changed)  # the user's own edit
  LICENSE  (new)
  old-notes.txt  (removed)
```

:::accordion
#### Source: `fixtures/format/40-file-tree-with-steps.dh.md`
````text
---
title: "File tree with steps"
description: A fixture made from the Format page section of the same name.
---

## File tree with steps

```filetree
@step After scaffold create
hello-app/
  .scaffold_state.yaml  (new)  # answers, kept for update
  README.md  (generated)
@step After the user edits it
hello-app/
  .scaffold_state.yaml
  README.md  (changed)  # the user's own edit
  LICENSE  (new)
  old-notes.txt  (removed)
```
````
:::


## Marks and prefixes

Every mark is written as a word in the source. Each part has a built-in list, and a page or a site may add its own (see the last block of this section); doccheck refuses a word that is in neither. The page shows the word as a chip, so there are no letters to learn.

**File tree:** the mark goes in brackets after the name.

| Written | The page shows | Meaning |
| --- | --- | --- |
| `(new)` | a green "new" chip | the file did not exist before |
| `(changed)` | an orange "changed" chip | the file existed and was edited |
| `(removed)` | a pink "removed" chip, name struck | the file is deleted |
| `(generated)` | a blue "generated" chip | a tool made it; do not edit by hand |
| `(conflict)` | a pink "conflict" chip | two changes disagree here |
| `(closed)` | the folder starts closed | only on a folder |
| `# text` | a note after the name | |
| `...` | a "more files" row | entries left out |

**Editor:** a step's lines are a diff of the file shown.

| Written | Meaning |
| --- | --- |
| `+line` | the line is added (green) |
| `-line` | the line is removed (pink, under "Before") |
| ` line` (a space) | the line is kept, to say where the edit is |
| `@@ <path>` | the edit is in this file |
| `@file <path>` | a made-up file; its lines follow |
| `(open)` | the file shown first |
| an "edited" chip in the tree | the page adds it to a file a step has changed |

**Terminal:** only the start of a line counts.

| Written | Meaning |
| --- | --- |
| `$ ` or `% ` | a command, typed at that prompt |
| `# ` | a command typed as root |
| anything else | output, shown as it is |

**Your own marks and prefixes.** A page may define its own, and a site too (see section 3.1 of the spec): a name, a label and a colour. They show only where a part uses them. The front matter of this page defines two marks and one prompt:



```filetree
app/
  api.ts
  parse.ts  (deprecated)
  next.ts  (experimental)  (new)
```

```terminal
$ python3
>>> print(1 + 1)
2
```

**Code walk:** `focus=17-18` marks the lines the note is about; `mark=29` puts a marker on one line.

:::accordion
#### Source: `fixtures/format/41-marks-and-prefixes.dh.md`
````text
---
title: "Marks and prefixes"
description: A fixture made from the Format page section of the same name.
marks:
  deprecated:
    label: deprecated
    colour: warn
    means: still works, but will be removed
  experimental:
    label: experimental
    colour: c3
    means: may change without notice
prefixes:
  ">>>":
    label: Python
    colour: c4
    means: a line typed at the Python prompt
---

## Marks and prefixes

Every mark is written as a word in the source. Each part has a built-in list, and a page or a site may add its own (see the last block of this section); doccheck refuses a word that is in neither. The page shows the word as a chip, so there are no letters to learn.

**File tree:** the mark goes in brackets after the name.

| Written | The page shows | Meaning |
| --- | --- | --- |
| `(new)` | a green "new" chip | the file did not exist before |
| `(changed)` | an orange "changed" chip | the file existed and was edited |
| `(removed)` | a pink "removed" chip, name struck | the file is deleted |
| `(generated)` | a blue "generated" chip | a tool made it; do not edit by hand |
| `(conflict)` | a pink "conflict" chip | two changes disagree here |
| `(closed)` | the folder starts closed | only on a folder |
| `# text` | a note after the name | |
| `...` | a "more files" row | entries left out |

**Editor:** a step's lines are a diff of the file shown.

| Written | Meaning |
| --- | --- |
| `+line` | the line is added (green) |
| `-line` | the line is removed (pink, under "Before") |
| ` line` (a space) | the line is kept, to say where the edit is |
| `@@ <path>` | the edit is in this file |
| `@file <path>` | a made-up file; its lines follow |
| `(open)` | the file shown first |
| an "edited" chip in the tree | the page adds it to a file a step has changed |

**Terminal:** only the start of a line counts.

| Written | Meaning |
| --- | --- |
| `$ ` or `% ` | a command, typed at that prompt |
| `# ` | a command typed as root |
| anything else | output, shown as it is |

**Your own marks and prefixes.** A page may define its own, and a site too (see section 3.1 of the spec): a name, a label and a colour. They show only where a part uses them. The front matter of this page defines two marks and one prompt:



```filetree
app/
  api.ts
  parse.ts  (deprecated)
  next.ts  (experimental)  (new)
```

```terminal
$ python3
>>> print(1 + 1)
2
```

**Code walk:** `focus=17-18` marks the lines the note is about; `mark=29` puts a marker on one line.
````
:::


## Editor

A small IDE: the file tree on the left and one file pane. Files come from a repo at the page's pin, or are made up right here with `@file`. Each `@step` is an edit: `+` adds a line, `-` removes one, a space keeps one; `@@ <file>` picks the file.

```editor
@file src/index.ts (open)
import { greet } from './greet';

console.log(greet('hello-app'));
@file src/greet.ts
export function greet(name: string) {
  return 'Hi ' + name;
}
@step Greet with an exclamation mark
@@ src/greet.ts
 export function greet(name: string) {
-  return 'Hi ' + name;
+  return 'Hi ' + name + '!';
 }
@step Pass the license too
@@ src/index.ts
-console.log(greet('hello-app'));
+console.log(greet('hello-app'), 'MIT');
```

:::accordion
#### Source: `fixtures/format/42-editor.dh.md`
````text
---
title: "Editor"
description: A fixture made from the Format page section of the same name.
---

## Editor

A small IDE: the file tree on the left and one file pane. Files come from a repo at the page's pin, or are made up right here with `@file`. Each `@step` is an edit: `+` adds a line, `-` removes one, a space keeps one; `@@ <file>` picks the file.

```editor
@file src/index.ts (open)
import { greet } from './greet';

console.log(greet('hello-app'));
@file src/greet.ts
export function greet(name: string) {
  return 'Hi ' + name;
}
@step Greet with an exclamation mark
@@ src/greet.ts
 export function greet(name: string) {
-  return 'Hi ' + name;
+  return 'Hi ' + name + '!';
 }
@step Pass the license too
@@ src/index.ts
-console.log(greet('hello-app'));
+console.log(greet('hello-app'), 'MIT');
```
````
:::


## Terminal

The shell-session convention every docs site already uses (it is GitHub's and Shiki's `console`/`shellsession`): a line that starts with `$ ` (or `% `, or `# ` for root) is a command, typed at that prompt and highlighted as bash; every other line is output, shown as it is, including a program's own questions and the answers typed into them. Each command is one step. The fence names `console` and `shellsession` give the same part.

```terminal
$ scaffold create acme/hello ./hello-app
? Project name? hello-app
? License? MIT
✔ Created hello-app
$ ls hello-app | grep -v node_modules
README.md
.scaffold_state.yaml
# chown -R app:app hello-app
```

:::accordion
#### Source: `fixtures/format/43-terminal.dh.md`
````text
---
title: "Terminal"
description: A fixture made from the Format page section of the same name.
---

## Terminal

The shell-session convention every docs site already uses (it is GitHub's and Shiki's `console`/`shellsession`): a line that starts with `$ ` (or `% `, or `# ` for root) is a command, typed at that prompt and highlighted as bash; every other line is output, shown as it is, including a program's own questions and the answers typed into them. Each command is one step. The fence names `console` and `shellsession` give the same part.

```terminal
$ scaffold create acme/hello ./hello-app
? Project name? hello-app
? License? MIT
✔ Created hello-app
$ ls hello-app | grep -v node_modules
README.md
.scaffold_state.yaml
# chown -R app:app hello-app
```
````
:::


## Code walk with inline code

A code walk takes code written right here too, with the editor's syntax: before the first `@step`, `@file <path>` makes a file up and its lines follow. A step then names that path; its range may be left out (the whole file). The editor reads repo files the same way the code walk does, so both parts take either.

```codewalk
@file src/greet.ts
export function greet(name: string) {
  const clean = name.trim();
  return 'Hi ' + clean + '!';
}
@step src/greet.ts focus=2
Trim the name first.
@step src/greet.ts#L3 focus=3
Then build the greeting.
```

:::accordion
#### Source: `fixtures/format/44-code-walk-with-inline-code.dh.md`
````text
---
title: "Code walk with inline code"
description: A fixture made from the Format page section of the same name.
---

## Code walk with inline code

A code walk takes code written right here too, with the editor's syntax: before the first `@step`, `@file <path>` makes a file up and its lines follow. A step then names that path; its range may be left out (the whole file). The editor reads repo files the same way the code walk does, so both parts take either.

```codewalk
@file src/greet.ts
export function greet(name: string) {
  const clean = name.trim();
  return 'Hi ' + clean + '!';
}
@step src/greet.ts focus=2
Trim the name first.
@step src/greet.ts#L3 focus=3
Then build the greeting.
```
````
:::


## Code walk: animated or still

A code walk has two modes. **Still** is for moving between different functions or files: the step's file is shown whole, the step's lines are open and marked, and the rest of the file is folded into a bar like "… 12 lines" that the reader can open. A move to the next step switches the marks and the folds at once, with no morph, because a morph between two different functions only confuses. **Animated** is for the same code changing, such as one function growing step by step: the lines morph into each other.

Nothing needs to be written: a move is animated when the next step is in the same file and its lines touch the lines of the step before; every other move is still. To say it, put `animate=on` or `animate=off` on the fence (every move) or on a `@step` line (the move into that step); `animate=auto` is the default.

Still: three steps across two files and three functions.

```codewalk
@file src/cart.ts
export function addItem(cart: Cart, item: Item): Cart {
  const found = cart.items.find((i) => i.sku === item.sku);
  if (found) {
    found.qty += item.qty;
    return cart;
  }
  return { ...cart, items: [...cart.items, item] };
}

export function removeItem(cart: Cart, sku: string): Cart {
  return { ...cart, items: cart.items.filter((i) => i.sku !== sku) };
}

export function total(cart: Cart): number {
  let sum = 0;
  for (const i of cart.items) sum += price(i) * i.qty;
  return sum;
}
@file src/price.ts
const RATES: Record<string, number> = { food: 0.05, book: 0, other: 0.2 };

export function price(item: Item): number {
  const tax = RATES[item.kind] ?? RATES.other;
  return Math.round(item.cents * (1 + tax));
}
@step src/cart.ts#L1-L8 focus=3-6
Adding an item that is already in the cart only raises its quantity.
@step src/cart.ts#L14-L18 focus=16
The total adds up one price for each item, times its quantity.
@step src/price.ts#L1-L6 focus=4-5
The price of one item is its cents plus the tax for its kind.
```

Animated: one function growing, one line at a time.

```codewalk
@file src/slug.ts
export function slugify(title: string): string {
  const lower = title.toLowerCase();
  const words = lower.split(/[^a-z0-9]+/);
  const clean = words.filter(Boolean);
  return clean.join('-');
}
@step src/slug.ts#L1-L2 focus=2
Start with the lower-case title.
@step #L1-L3 focus=3
Split it at anything that is not a letter or a digit.
@step #L1-L4 focus=4
Splitting can leave empty words at the edges; drop them.
@step #L1-L5 focus=5
Join the words with dashes.
```

:::accordion
#### Source: `fixtures/format/45-code-walk-animated-or-still.dh.md`
````text
---
title: "Code walk: animated or still"
description: A fixture made from the Format page section of the same name.
---

## Code walk: animated or still

A code walk has two modes. **Still** is for moving between different functions or files: the step's file is shown whole, the step's lines are open and marked, and the rest of the file is folded into a bar like "… 12 lines" that the reader can open. A move to the next step switches the marks and the folds at once, with no morph, because a morph between two different functions only confuses. **Animated** is for the same code changing, such as one function growing step by step: the lines morph into each other.

Nothing needs to be written: a move is animated when the next step is in the same file and its lines touch the lines of the step before; every other move is still. To say it, put `animate=on` or `animate=off` on the fence (every move) or on a `@step` line (the move into that step); `animate=auto` is the default.

Still: three steps across two files and three functions.

```codewalk
@file src/cart.ts
export function addItem(cart: Cart, item: Item): Cart {
  const found = cart.items.find((i) => i.sku === item.sku);
  if (found) {
    found.qty += item.qty;
    return cart;
  }
  return { ...cart, items: [...cart.items, item] };
}

export function removeItem(cart: Cart, sku: string): Cart {
  return { ...cart, items: cart.items.filter((i) => i.sku !== sku) };
}

export function total(cart: Cart): number {
  let sum = 0;
  for (const i of cart.items) sum += price(i) * i.qty;
  return sum;
}
@file src/price.ts
const RATES: Record<string, number> = { food: 0.05, book: 0, other: 0.2 };

export function price(item: Item): number {
  const tax = RATES[item.kind] ?? RATES.other;
  return Math.round(item.cents * (1 + tax));
}
@step src/cart.ts#L1-L8 focus=3-6
Adding an item that is already in the cart only raises its quantity.
@step src/cart.ts#L14-L18 focus=16
The total adds up one price for each item, times its quantity.
@step src/price.ts#L1-L6 focus=4-5
The price of one item is its cents plus the tax for its kind.
```

Animated: one function growing, one line at a time.

```codewalk
@file src/slug.ts
export function slugify(title: string): string {
  const lower = title.toLowerCase();
  const words = lower.split(/[^a-z0-9]+/);
  const clean = words.filter(Boolean);
  return clean.join('-');
}
@step src/slug.ts#L1-L2 focus=2
Start with the lower-case title.
@step #L1-L3 focus=3
Split it at anything that is not a letter or a digit.
@step #L1-L4 focus=4
Splitting can leave empty words at the edges; drop them.
@step #L1-L5 focus=5
Join the words with dashes.
```
````
:::


## Replacing a part for LLMs

Any part can be followed by `:::llm`; an LLM reads that text instead of the part.

```filetree
hello-app/
  .scaffold_state.yaml  (new)
  README.md  (generated)
  LICENSE  (generated)
  package.json  (generated)
  src/
    index.ts  (generated)
```

:::llm
`scaffold create` makes the project folder with the state file `.scaffold_state.yaml` and the files the template made.
:::

:::accordion
#### Source: `fixtures/format/46-replacing-a-part-for-llms.dh.md`
````text
---
title: "Replacing a part for LLMs"
description: A fixture made from the Format page section of the same name.
---

## Replacing a part for LLMs

Any part can be followed by `:::llm`; an LLM reads that text instead of the part.

```filetree
hello-app/
  .scaffold_state.yaml  (new)
  README.md  (generated)
  LICENSE  (generated)
  package.json  (generated)
  src/
    index.ts  (generated)
```

:::llm
`scaffold create` makes the project folder with the state file `.scaffold_state.yaml` and the files the template made.
:::
````
:::


## Chart steps

Each step shows its own data on top of the one before; one control row steps through them.

```chart
kind: line
title: Requests per second
x: { label: time, values: ["10:00", "10:05", "10:10"] }
series:
  - name: api
    data: [120, 130, 125]
steps:
  - title: A normal morning.
  - title: The deploy doubles the load.
    series:
      - name: api
        data: [120, 130, 260]
  - title: A worker joins.
    series:
      - name: worker
        add: true
        data: [1, 2, 3]
```

:::accordion
#### Source: `fixtures/format/74-chart-steps.dh.md`
````text
---
title: "Chart steps"
description: A sample of the chart features of format version 11.
---

## Chart steps

Each step shows its own data on top of the one before; one control row steps through them.

```chart
kind: line
title: Requests per second
x: { label: time, values: ["10:00", "10:05", "10:10"] }
series:
  - name: api
    data: [120, 130, 125]
steps:
  - title: A normal morning.
  - title: The deploy doubles the load.
    series:
      - name: api
        data: [120, 130, 260]
  - title: A worker joins.
    series:
      - name: worker
        add: true
        data: [1, 2, 3]
```
````
:::


## Chart time axis and annotations

A time axis in a named zone, with an event, a range and a threshold. Each marker is a button that opens a note.

```chart
kind: line
title: Latency
x: { scale: time }
y: { label: latency, format: duration-ms }
tz: America/Los_Angeles
series:
  - name: p95
    data: [["2026-11-20T10:00", 120], ["2026-11-20T10:05", 130], ["2026-11-20T10:10", 410], ["2026-11-20T10:15", 150]]
annotations:
  - at: 2026-11-20T10:08
    label: Deploy v1.4
    text: Moved sessions to the new cache.
    tone: acc
  - from: 2026-11-20T10:09
    to: 2026-11-20T10:13
    label: Incident 42
    tone: bad
  - y: 300
    label: SLO
    tone: warn
    fill: above
```

:::accordion
#### Source: `fixtures/format/75-chart-time-annotations.dh.md`
````text
---
title: "Chart time axis and annotations"
description: A sample of the chart features of format version 11.
---

## Chart time axis and annotations

A time axis in a named zone, with an event, a range and a threshold. Each marker is a button that opens a note.

```chart
kind: line
title: Latency
x: { scale: time }
y: { label: latency, format: duration-ms }
tz: America/Los_Angeles
series:
  - name: p95
    data: [["2026-11-20T10:00", 120], ["2026-11-20T10:05", 130], ["2026-11-20T10:10", 410], ["2026-11-20T10:15", 150]]
annotations:
  - at: 2026-11-20T10:08
    label: Deploy v1.4
    text: Moved sessions to the new cache.
    tone: acc
  - from: 2026-11-20T10:09
    to: 2026-11-20T10:13
    label: Incident 42
    tone: bad
  - y: 300
    label: SLO
    tone: warn
    fill: above
```
````
:::


## Chart heatmap

A heatmap draws one cell per value; an empty cell is null.

```chart
kind: heatmap
title: Errors by hour
x: { label: hour, values: ["00", "04", "08"] }
y: { label: day, values: [Mon, Tue] }
series:
  - name: errors
    data:
      - [0, 1, 4]
      - [null, 2, 12]
```

:::accordion
#### Source: `fixtures/format/76-chart-heatmap.dh.md`
````text
---
title: "Chart heatmap"
description: A sample of the chart features of format version 11.
---

## Chart heatmap

A heatmap draws one cell per value; an empty cell is null.

```chart
kind: heatmap
title: Errors by hour
x: { label: hour, values: ["00", "04", "08"] }
y: { label: day, values: [Mon, Tue] }
series:
  - name: errors
    data:
      - [0, 1, 4]
      - [null, 2, 12]
```
````
:::


## Chart line styles and markers

Each series has its own line style and marker, and a key that shows both.

```chart
kind: line
x: { label: month, values: [Jan, Feb, Mar, Apr] }
y: { label: loans }
series:
  - name: This year
    line: solid
    marker: circle
    data: [820, 860, 910, 990]
  - name: Forecast
    line: dashed
    marker: diamond
    data: [null, null, 910, 1000]
  - name: Last year
    line: dotted
    marker: none
    data: [760, 790, 840, 900]
```

:::accordion
#### Source: `fixtures/format/77-chart-line-styles.dh.md`
````text
---
title: "Chart line styles and markers"
description: A sample of the chart features of format version 11.
---

## Chart line styles and markers

Each series has its own line style and marker, and a key that shows both.

```chart
kind: line
x: { label: month, values: [Jan, Feb, Mar, Apr] }
y: { label: loans }
series:
  - name: This year
    line: solid
    marker: circle
    data: [820, 860, 910, 990]
  - name: Forecast
    line: dashed
    marker: diamond
    data: [null, null, 910, 1000]
  - name: Last year
    line: dotted
    marker: none
    data: [760, 790, 840, 900]
```
````
:::


## Chart log and linear switch

The reader can switch the y axis between log and linear.

```chart
kind: line
x: { label: year, values: [2020, 2021, 2022, 2023] }
y: { label: requests, scale: log, toggle: true }
series:
  - name: Web
    data: [1200, 8100, 61000, 410000]
  - name: Batch
    data: [30, 70, 150, 400]
```

:::accordion
#### Source: `fixtures/format/78-chart-log-toggle.dh.md`
````text
---
title: "Chart log and linear switch"
description: A sample of the chart features of format version 11.
---

## Chart log and linear switch

The reader can switch the y axis between log and linear.

```chart
kind: line
x: { label: year, values: [2020, 2021, 2022, 2023] }
y: { label: requests, scale: log, toggle: true }
series:
  - name: Web
    data: [1200, 8100, 61000, 410000]
  - name: Batch
    data: [30, 70, 150, 400]
```
````
:::


## Chart calculator

The calculator layout: inputs, one row per formula and one result.

```chart
layout: calculator
title: Storage bill
controls:
  - slider: stored
    label: Data stored
    unit: GB
    min: 100
    max: 5000
    step: 100
    value: 1200
  - slider: price
    label: Price per GB
    unit: USD per GB
    min: 0.01
    max: 0.1
    step: 0.001
    value: 0.023
  - toggle: second
    label: Second copy
    value: false
let:
  storage: "stored * price * (second ? 2 : 1)"
  fees: stored / 100
  total: storage + fees
calc:
  - let: storage
    label: Storage
    format: money
  - let: fees
    label: Fees
    unit: units
  - let: total
    label: Monthly bill
    format: money
    result: true
```

:::accordion
#### Source: `fixtures/format/79-chart-calculator.dh.md`
````text
---
title: "Chart calculator"
description: A sample of the chart features of format version 11.
---

## Chart calculator

The calculator layout: inputs, one row per formula and one result.

```chart
layout: calculator
title: Storage bill
controls:
  - slider: stored
    label: Data stored
    unit: GB
    min: 100
    max: 5000
    step: 100
    value: 1200
  - slider: price
    label: Price per GB
    unit: USD per GB
    min: 0.01
    max: 0.1
    step: 0.001
    value: 0.023
  - toggle: second
    label: Second copy
    value: false
let:
  storage: "stored * price * (second ? 2 : 1)"
  fees: stored / 100
  total: storage + fees
calc:
  - let: storage
    label: Storage
    format: money
  - let: fees
    label: Fees
    unit: units
  - let: total
    label: Monthly bill
    format: money
    result: true
```
````
:::


## References

A part on a line of its own is a block: the host's resolver answers for it, and without one the label shows as a chip.

[[chart:revenue-2026 "Revenue by month, 2026"]]

[[svg:architecture.dark "The system at a glance"]]

[[interactive:compound-growth "Compound growth, with a slider"]]

Inside a sentence a reference is a chip: the build log is in [[terminal:build-42 "the build"]], and the label is optional, as in [[filetree:repo-layout]].

In code it is text: `[[chart:revenue-2026]]` stays as written, and so does a fence:

```text
[[svg:logo "not a reference here"]]
```

A word that is not a part type is plain text too: [[note:this]] and [[1, 2]].

:::accordion
#### Source: `fixtures/format/80-references.dh.md`
````text
---
title: "References"
description: Parts the host keeps, referenced by type and name; the page holds only the reference and its label.
---

## References

A part on a line of its own is a block: the host's resolver answers for it, and without one the label shows as a chip.

[[chart:revenue-2026 "Revenue by month, 2026"]]

[[svg:architecture.dark "The system at a glance"]]

[[interactive:compound-growth "Compound growth, with a slider"]]

Inside a sentence a reference is a chip: the build log is in [[terminal:build-42 "the build"]], and the label is optional, as in [[filetree:repo-layout]].

In code it is text: `[[chart:revenue-2026]]` stays as written, and so does a fence:

```text
[[svg:logo "not a reference here"]]
```

A word that is not a part type is plain text too: [[note:this]] and [[1, 2]].
````
:::


## Static: the same parts live and still

Any part that steps or moves can stand still. `static` on the fence draws the finished state, and `static=2` or `static="<step title>"` draws that step, with no player, no control row and no motion. Printing, a page with `static: true` in its front matter, a host option and the reader's "reduce motion" setting use the same option. The LLM view is the same for both.

### A scene

Live:

```animation layout=graph
person u "reader"
box web "web server"
cylinder db "database"
box log "access log"
@step The reader asks for a page.
u -> web "GET /"
@step The server reads the row it needs.
web -> db "SELECT"
@step The server writes the visit to its log.
web -> log "visit"
```

Static, the finished state:

```animation layout=graph static
person u "reader"
box web "web server"
cylinder db "database"
box log "access log"
@step The reader asks for a page.
u -> web "GET /"
@step The server reads the row it needs.
web -> db "SELECT"
@step The server writes the visit to its log.
web -> log "visit"
```

### A terminal

Live:

```terminal title="setup"
$ bun add durian-hypermedia
installed durian-hypermedia
$ bun test
301 pass, 0 fail
```

Static, every command typed:

```terminal title="setup" static
$ bun add durian-hypermedia
installed durian-hypermedia
$ bun test
301 pass, 0 fail
```

### A file tree

Live:

```filetree
@step The app starts with one file
app/
  api.ts
@step A parser joins it
app/
  api.ts
  parse.ts  (new)
```

Static, the step named "The app starts with one file":

```filetree static="The app starts with one file"
@step The app starts with one file
app/
  api.ts
@step A parser joins it
app/
  api.ts
  parse.ts  (new)
```

:::accordion
#### Source: `fixtures/format/81-static-live-and-still.dh.md`
````text
---
title: "Static: the same parts live and still"
description: The same scene, terminal and file tree twice, live and then static (SPEC 4.1); print draws every part this way.
---

## Static: the same parts live and still

Any part that steps or moves can stand still. `static` on the fence draws the finished state, and `static=2` or `static="<step title>"` draws that step, with no player, no control row and no motion. Printing, a page with `static: true` in its front matter, a host option and the reader's "reduce motion" setting use the same option. The LLM view is the same for both.

### A scene

Live:

```animation layout=graph
person u "reader"
box web "web server"
cylinder db "database"
box log "access log"
@step The reader asks for a page.
u -> web "GET /"
@step The server reads the row it needs.
web -> db "SELECT"
@step The server writes the visit to its log.
web -> log "visit"
```

Static, the finished state:

```animation layout=graph static
person u "reader"
box web "web server"
cylinder db "database"
box log "access log"
@step The reader asks for a page.
u -> web "GET /"
@step The server reads the row it needs.
web -> db "SELECT"
@step The server writes the visit to its log.
web -> log "visit"
```

### A terminal

Live:

```terminal title="setup"
$ bun add durian-hypermedia
installed durian-hypermedia
$ bun test
301 pass, 0 fail
```

Static, every command typed:

```terminal title="setup" static
$ bun add durian-hypermedia
installed durian-hypermedia
$ bun test
301 pass, 0 fail
```

### A file tree

Live:

```filetree
@step The app starts with one file
app/
  api.ts
@step A parser joins it
app/
  api.ts
  parse.ts  (new)
```

Static, the step named "The app starts with one file":

```filetree static="The app starts with one file"
@step The app starts with one file
app/
  api.ts
@step A parser joins it
app/
  api.ts
  parse.ts  (new)
```
````
:::


## State: a state machine that its steps walk

A `state` part draws a state machine from its transitions. `at` says where the walk is, and `fire` takes the one transition with that event from there.

```state title="An order"
[start] -> cart
cart -> paying "check out"
paying -> paid "card accepted"
paying -> cart "card declined"
paid -> shipped "ship"
shipped -> [end]
state paying "Paying" note="waits up to 10 minutes for the bank"
group done "Fulfilment": paid, shipped
@step A shopper fills the cart.
at cart
@step They check out.
fire check out
@step The bank declines the card: back to the cart.
fire card declined
@step They try another card, and the bank takes it.
at paying
fire card accepted
```


The same machine, static (the finished walk, no player):

```state static=true title="An order, static"
[start] -> cart
cart -> paying "check out"
paying -> paid "card accepted"
paying -> cart "card declined"
paid -> shipped "ship"
shipped -> [end]
state paying "Paying" note="waits up to 10 minutes for the bank"
group done "Fulfilment": paid, shipped
@step A shopper fills the cart.
at cart
@step They check out.
fire check out
@step The bank declines the card: back to the cart.
fire card declined
@step They try another card, and the bank takes it.
at paying
fire card accepted
```

:::accordion
#### Source: `fixtures/format/90-state-diagram.dh.md`
````text
---
title: "State: a state machine that its steps walk"
description: A state diagram drawn from its transitions; each step walks one transition (SPEC 3.2 State). Shown live, then static.
---

## State: a state machine that its steps walk

A `state` part draws a state machine from its transitions. `at` says where the walk is, and `fire` takes the one transition with that event from there.

```state title="An order"
[start] -> cart
cart -> paying "check out"
paying -> paid "card accepted"
paying -> cart "card declined"
paid -> shipped "ship"
shipped -> [end]
state paying "Paying" note="waits up to 10 minutes for the bank"
group done "Fulfilment": paid, shipped
@step A shopper fills the cart.
at cart
@step They check out.
fire check out
@step The bank declines the card: back to the cart.
fire card declined
@step They try another card, and the bank takes it.
at paying
fire card accepted
```


The same machine, static (the finished walk, no player):

```state static=true title="An order, static"
[start] -> cart
cart -> paying "check out"
paying -> paid "card accepted"
paying -> cart "card declined"
paid -> shipped "ship"
shipped -> [end]
state paying "Paying" note="waits up to 10 minutes for the bank"
group done "Fulfilment": paid, shipped
@step A shopper fills the cart.
at cart
@step They check out.
fire check out
@step The bank declines the card: back to the cart.
fire card declined
@step They try another card, and the bank takes it.
at paying
fire card accepted
```
````
:::


## Class: types and how they relate

A `class` part draws classes from their members and from relations written in words: `extends`, `implements`, `owns`, `has`, `uses` and `->`.

```class title="Orders"
class Order note="An order is written once, at check out."
  + id: OrderId
  + total(): Money
  - lines: Line[]
class Line
  + quantity: int
interface Payable
  + pay(amount: Money): Receipt
abstract class Shape
enum Status: open, paid, shipped
Order implements Payable
Order owns 1..* Line
Order has 1 Status
Circle extends Shape
Order uses Clock
Order 0..* -> 1 Customer "placed by"
```


The same diagram, static:

```class static=true title="Orders, static"
class Order note="An order is written once, at check out."
  + id: OrderId
  + total(): Money
  - lines: Line[]
class Line
  + quantity: int
interface Payable
  + pay(amount: Money): Receipt
abstract class Shape
enum Status: open, paid, shipped
Order implements Payable
Order owns 1..* Line
Order has 1 Status
Circle extends Shape
Order uses Clock
Order 0..* -> 1 Customer "placed by"
```

:::accordion
#### Source: `fixtures/format/91-class-diagram.dh.md`
````text
---
title: "Class: types and how they relate"
description: A class diagram drawn from members and relations written in words (SPEC 3.2 Class). Shown whole, then static.
---

## Class: types and how they relate

A `class` part draws classes from their members and from relations written in words: `extends`, `implements`, `owns`, `has`, `uses` and `->`.

```class title="Orders"
class Order note="An order is written once, at check out."
  + id: OrderId
  + total(): Money
  - lines: Line[]
class Line
  + quantity: int
interface Payable
  + pay(amount: Money): Receipt
abstract class Shape
enum Status: open, paid, shipped
Order implements Payable
Order owns 1..* Line
Order has 1 Status
Circle extends Shape
Order uses Clock
Order 0..* -> 1 Customer "placed by"
```


The same diagram, static:

```class static=true title="Orders, static"
class Order note="An order is written once, at check out."
  + id: OrderId
  + total(): Money
  - lines: Line[]
class Line
  + quantity: int
interface Payable
  + pay(amount: Money): Receipt
abstract class Shape
enum Status: open, paid, shipped
Order implements Payable
Order owns 1..* Line
Order has 1 Status
Circle extends Shape
Order uses Clock
Order 0..* -> 1 Customer "placed by"
```
````
:::


## ER: tables and their keys

An `er` part draws tables with their keys and joins them with crow's-foot lines, each from the key to what it points at. A step may light a table or a column.

```er title="Shop"
entity customer "Customer" [c1]
  id uuid pk
  email text unique
entity order "Order" [c2]
  id uuid pk
  customer_id uuid fk -> customer.id
  placed_at timestamptz
entity line "Order line" [c2]
  order_id uuid fk -> order.id
  product text
  quantity int
customer 1 -- 0..* order "places"
order 1 -- 1..* line "holds"
@step Start from the customer's key.
highlight customer.id
@step Each order keeps it in `customer_id`.
highlight order.customer_id
@step Each line of an order keeps the order's key in `order_id`.
highlight line.order_id
```


The same diagram, static:

```er static=true title="Shop, static"
entity customer "Customer" [c1]
  id uuid pk
  email text unique
entity order "Order" [c2]
  id uuid pk
  customer_id uuid fk -> customer.id
  placed_at timestamptz
entity line "Order line" [c2]
  order_id uuid fk -> order.id
  product text
  quantity int
customer 1 -- 0..* order "places"
order 1 -- 1..* line "holds"
@step Start from the customer's key.
highlight customer.id
@step Each order keeps it in `customer_id`.
highlight order.customer_id
@step Each line of an order keeps the order's key in `order_id`.
highlight line.order_id
```

:::accordion
#### Source: `fixtures/format/92-er-diagram.dh.md`
````text
---
title: "ER: tables and their keys"
description: An entity-relationship diagram with crow's-foot lines from key to key (SPEC 3.2 ER). Shown live, then static.
---

## ER: tables and their keys

An `er` part draws tables with their keys and joins them with crow's-foot lines, each from the key to what it points at. A step may light a table or a column.

```er title="Shop"
entity customer "Customer" [c1]
  id uuid pk
  email text unique
entity order "Order" [c2]
  id uuid pk
  customer_id uuid fk -> customer.id
  placed_at timestamptz
entity line "Order line" [c2]
  order_id uuid fk -> order.id
  product text
  quantity int
customer 1 -- 0..* order "places"
order 1 -- 1..* line "holds"
@step Start from the customer's key.
highlight customer.id
@step Each order keeps it in `customer_id`.
highlight order.customer_id
@step Each line of an order keeps the order's key in `order_id`.
highlight line.order_id
```


The same diagram, static:

```er static=true title="Shop, static"
entity customer "Customer" [c1]
  id uuid pk
  email text unique
entity order "Order" [c2]
  id uuid pk
  customer_id uuid fk -> customer.id
  placed_at timestamptz
entity line "Order line" [c2]
  order_id uuid fk -> order.id
  product text
  quantity int
customer 1 -- 0..* order "places"
order 1 -- 1..* line "holds"
@step Start from the customer's key.
highlight customer.id
@step Each order keeps it in `customer_id`.
highlight order.customer_id
@step Each line of an order keeps the order's key in `order_id`.
highlight line.order_id
```
````
:::

# Animations (graph engine)


## Animation: the engine

One language for every animation: a free 2D space of **entities** (shapes, containers, data structures, tokens), **connectors** that follow their ends, **layouts** that place things, a **camera**, and **steps** of changes that run together. The reader can step, or explore: drag to move, pinch or Ctrl + wheel to zoom, click a thing to read its note, then "Back to the story". Here, an array is sorted: `swap` trades two cells, `highlight` lights them for one step, a pointer moves.

```animation
array a: 5 2 8 1
pointer i "i" at a.0
@step Bubble sort compares neighbours. 5 and 2 are out of order.
highlight a.0 a.1
@step So they swap: 2 now comes first.
swap a.0 a.1
@step It compares 5 and 8: in order, so they stay.
move i to a.1
highlight a.1 a.2
@step 8 and 1 are not: they swap, and 8, the biggest, has reached the end.
move i to a.2
swap a.2 a.3
set a.3 tone=good
@step Two more passes move 1 to the front. The array is sorted.
swap a.1 a.2
swap a.0 a.1
set a.0 tone=good
set a.1 tone=good
set a.2 tone=good
remove i
```

:::accordion
#### Source: `fixtures/format/47-animation-the-engine.dh.md`
````text
---
title: "Animation: the engine"
description: A fixture made from the Format page section of the same name.
---

## Animation: the engine

One language for every animation: a free 2D space of **entities** (shapes, containers, data structures, tokens), **connectors** that follow their ends, **layouts** that place things, a **camera**, and **steps** of changes that run together. The reader can step, or explore: drag to move, pinch or Ctrl + wheel to zoom, click a thing to read its note, then "Back to the story". Here, an array is sorted: `swap` trades two cells, `highlight` lights them for one step, a pointer moves.

```animation
array a: 5 2 8 1
pointer i "i" at a.0
@step Bubble sort compares neighbours. 5 and 2 are out of order.
highlight a.0 a.1
@step So they swap: 2 now comes first.
swap a.0 a.1
@step It compares 5 and 8: in order, so they stay.
move i to a.1
highlight a.1 a.2
@step 8 and 1 are not: they swap, and 8, the biggest, has reached the end.
move i to a.2
swap a.2 a.3
set a.3 tone=good
@step Two more passes move 1 to the front. The array is sorted.
swap a.1 a.2
swap a.0 a.1
set a.0 tone=good
set a.1 tone=good
set a.2 tone=good
remove i
```
````
:::


## Animation: binary search tree insert

A `tree` lays out its nodes; `under n3 right` puts a node on a side. A token walks down, and the camera moves in for the insert.

```animation
tree t
circle n8 "8" in t
circle n3 "3" in t under n8 left
circle n10 "10" in t under n8 right
circle n1 "1" in t under n3 left
circle n14 "14" in t under n10 right
@step Insert 6. Start at the root: 6 is less than 8, so go left.
add token k "6" at n8
highlight n8
@step 6 is more than 3, so go right.
move k to n3
highlight n3
@step 3 has no right child: 6 goes there.
add circle n6 "6" in t under n3 right
remove k
set n6 tone=good
camera n3
@step The order holds: everything left of a node is smaller, everything right of it is bigger.
camera all
```

:::accordion
#### Source: `fixtures/format/48-animation-binary-search-tree-insert.dh.md`
````text
---
title: "Animation: binary search tree insert"
description: A fixture made from the Format page section of the same name.
---

## Animation: binary search tree insert

A `tree` lays out its nodes; `under n3 right` puts a node on a side. A token walks down, and the camera moves in for the insert.

```animation
tree t
circle n8 "8" in t
circle n3 "3" in t under n8 left
circle n10 "10" in t under n8 right
circle n1 "1" in t under n3 left
circle n14 "14" in t under n10 right
@step Insert 6. Start at the root: 6 is less than 8, so go left.
add token k "6" at n8
highlight n8
@step 6 is more than 3, so go right.
move k to n3
highlight n3
@step 3 has no right child: 6 goes there.
add circle n6 "6" in t under n3 right
remove k
set n6 tone=good
camera n3
@step The order holds: everything left of a node is smaller, everything right of it is bigger.
camera all
```
````
:::


## Animation: hash table with a collision

`buckets` makes a hash table's buckets; two keys in one bucket make a chain. `send` moves a token along a path.

```animation
buckets h "hash table" count=5
@step hash("apple") mod 5 is 2, so apple goes in bucket 2.
add pill apple "apple" in h.2
highlight h.2
@step hash("kiwi") mod 5 is 4; bucket 4 is empty.
add pill kiwi "kiwi" in h.4
@step hash("grape") mod 5 is also 2: a collision.
add pill grape "grape" in h.2
highlight apple grape tone=warn
say h.2: two keys, one bucket
@step The bucket keeps a chain. Finding grape starts at bucket 2, which leads to apple.
send "find grape" h.2 -> apple
camera h.2 close
@step apple is not grape, so the search follows the chain one more link, to grape.
send "find grape" apple -> grape
```

:::accordion
#### Source: `fixtures/format/49-animation-hash-table-with-a-collision.dh.md`
````text
---
title: "Animation: hash table with a collision"
description: A fixture made from the Format page section of the same name.
---

## Animation: hash table with a collision

`buckets` makes a hash table's buckets; two keys in one bucket make a chain. `send` moves a token along a path.

```animation
buckets h "hash table" count=5
@step hash("apple") mod 5 is 2, so apple goes in bucket 2.
add pill apple "apple" in h.2
highlight h.2
@step hash("kiwi") mod 5 is 4; bucket 4 is empty.
add pill kiwi "kiwi" in h.4
@step hash("grape") mod 5 is also 2: a collision.
add pill grape "grape" in h.2
highlight apple grape tone=warn
say h.2: two keys, one bucket
@step The bucket keeps a chain. Finding grape starts at bucket 2, which leads to apple.
send "find grape" h.2 -> apple
camera h.2 close
@step apple is not grape, so the search follows the chain one more link, to grape.
send "find grape" apple -> grape
```
````
:::


## Animation: sharding, then rebalancing

Shards are containers holding key ranges; `move` puts a range in another shard, and its connectors follow.

```animation
pill router "router"
group s1 "shard 1" layout=column
group s2 "shard 2" layout=column
pill k1 "users 1–100" in s1
pill k2 "users 101–200" in s1
pill k3 "users 201–300" in s2
pill k4 "users 301–400" in s2
router -> s1
router -> s2
note router: maps each key range to a shard
@step The router sends each request to the shard that holds the user's key range.
send "user 250" router -> s2
@step Shard 2 is getting full. A third shard joins, empty.
add group s3 "shard 3" layout=column
router -> s3
set s2 tone=warn
@step Rebalance: the range 301–400 moves to shard 3.
move k4 to s3
set s2 tone=plain
@step The router's map changes with it: user 350 now goes to shard 3.
send "user 350" router -> s3
```

:::accordion
#### Source: `fixtures/format/50-animation-sharding-then-rebalancing.dh.md`
````text
---
title: "Animation: sharding, then rebalancing"
description: A fixture made from the Format page section of the same name.
---

## Animation: sharding, then rebalancing

Shards are containers holding key ranges; `move` puts a range in another shard, and its connectors follow.

```animation
pill router "router"
group s1 "shard 1" layout=column
group s2 "shard 2" layout=column
pill k1 "users 1–100" in s1
pill k2 "users 101–200" in s1
pill k3 "users 201–300" in s2
pill k4 "users 301–400" in s2
router -> s1
router -> s2
note router: maps each key range to a shard
@step The router sends each request to the shard that holds the user's key range.
send "user 250" router -> s2
@step Shard 2 is getting full. A third shard joins, empty.
add group s3 "shard 3" layout=column
router -> s3
set s2 tone=warn
@step Rebalance: the range 301–400 moves to shard 3.
move k4 to s3
set s2 tone=plain
@step The router's map changes with it: user 350 now goes to shard 3.
send "user 350" router -> s3
```
````
:::


## Animation: replicas and failover

`set d1 down=yes` takes the primary down; `move d2 to pg` promotes a replica into the primary's place, and the connectors change with it.

```animation
family app "the app"
family db "databases"
family copy "copying"
pill app "app" is=app
group pg "primary" layout=column
cylinder d1 "db-1" in pg is=db
group rg "replicas" layout=column
cylinder d2 "db-2" in rg is=db
cylinder d3 "db-3" in rg is=db
app -> d1 "writes" is=app
d1 --> d2 "copies" is=copy
d1 --> d3 "copies" is=copy
@step The app writes to the primary.
send "write" app -> d1
@step The primary copies the write to both replicas.
send "copy" d1 -> d2 is=copy
send "copy" d1 -> d3 is=copy
@step The primary's machine dies, so it can take no more writes.
set d1 down=yes
say d1: no heartbeat
@step db-2 has the newest copy, so it is promoted: it moves to the primary's place, and the app writes to it.
move d2 to pg
remove app -> d1
app -> d2 "writes" is=app
@step The dead one is taken out, and the app writes to the new primary.
remove d1
d2 --> d3 "copies" is=copy
send "write" app -> d2
@step db-3 now copies from the new primary.
send "copy" d2 -> d3 is=copy
```

:::accordion
#### Source: `fixtures/format/51-animation-replicas-and-failover.dh.md`
````text
---
title: "Animation: replicas and failover"
description: A fixture made from the Format page section of the same name.
---

## Animation: replicas and failover

`set d1 down=yes` takes the primary down; `move d2 to pg` promotes a replica into the primary's place, and the connectors change with it.

```animation
family app "the app"
family db "databases"
family copy "copying"
pill app "app" is=app
group pg "primary" layout=column
cylinder d1 "db-1" in pg is=db
group rg "replicas" layout=column
cylinder d2 "db-2" in rg is=db
cylinder d3 "db-3" in rg is=db
app -> d1 "writes" is=app
d1 --> d2 "copies" is=copy
d1 --> d3 "copies" is=copy
@step The app writes to the primary.
send "write" app -> d1
@step The primary copies the write to both replicas.
send "copy" d1 -> d2 is=copy
send "copy" d1 -> d3 is=copy
@step The primary's machine dies, so it can take no more writes.
set d1 down=yes
say d1: no heartbeat
@step db-2 has the newest copy, so it is promoted: it moves to the primary's place, and the app writes to it.
move d2 to pg
remove app -> d1
app -> d2 "writes" is=app
@step The dead one is taken out, and the app writes to the new primary.
remove d1
d2 --> d3 "copies" is=copy
send "write" app -> d2
@step db-3 now copies from the new primary.
send "copy" d2 -> d3 is=copy
```
````
:::


## Animation: pods, nodes, a service

Containers nest: pods in nodes in a cluster. A service is a stable name in front of pods; when a node dies, a pod is started elsewhere.

```animation dir=down
family svc "service"
family web "web pods"
family cache "cache pods"
group cluster "cluster" layout=row
group n1 "node 1" in cluster
group n2 "node 2" in cluster
group n3 "node 3" in cluster
pill w1 "web-1" in n1 is=web
pill c1 "cache-1" in n1 is=cache
pill w2 "web-2" in n2 is=web
pill w3 "web-3" in n3 is=web
pill svc "service: web" is=svc
svc -> w1 is=svc
svc -> w2 is=svc
svc -> w3 is=svc
note svc: one stable name and address in front of the web pods
@step Pods run on nodes; nodes make up the cluster. The service is one name in front of the three web pods.
camera all
@step Calls to the service are spread over its pods: rules on every node pick one.
send "GET /" svc -> w1
send "GET /cart" svc -> w2
@step Node 2 dies, and web-2 with it.
set n2 down=yes
set w2 down=yes
camera cluster
@step The scheduler starts a new web-2 on node 3, which has room.
remove w2
add pill w2b "web-2" in n3 is=web
svc -> w2b is=svc
@step The rules now pick among the running pods only; nobody sees a gap.
send "GET /cart" svc -> w2b
camera all
```

:::accordion
#### Source: `fixtures/format/52-animation-pods-nodes-a-service.dh.md`
````text
---
title: "Animation: pods, nodes, a service"
description: A fixture made from the Format page section of the same name.
---

## Animation: pods, nodes, a service

Containers nest: pods in nodes in a cluster. A service is a stable name in front of pods; when a node dies, a pod is started elsewhere.

```animation dir=down
family svc "service"
family web "web pods"
family cache "cache pods"
group cluster "cluster" layout=row
group n1 "node 1" in cluster
group n2 "node 2" in cluster
group n3 "node 3" in cluster
pill w1 "web-1" in n1 is=web
pill c1 "cache-1" in n1 is=cache
pill w2 "web-2" in n2 is=web
pill w3 "web-3" in n3 is=web
pill svc "service: web" is=svc
svc -> w1 is=svc
svc -> w2 is=svc
svc -> w3 is=svc
note svc: one stable name and address in front of the web pods
@step Pods run on nodes; nodes make up the cluster. The service is one name in front of the three web pods.
camera all
@step Calls to the service are spread over its pods: rules on every node pick one.
send "GET /" svc -> w1
send "GET /cart" svc -> w2
@step Node 2 dies, and web-2 with it.
set n2 down=yes
set w2 down=yes
camera cluster
@step The scheduler starts a new web-2 on node 3, which has room.
remove w2
add pill w2b "web-2" in n3 is=web
svc -> w2b is=svc
@step The rules now pick among the running pods only; nobody sees a gap.
send "GET /cart" svc -> w2b
camera all
```
````
:::


## Animation: a service mesh

Each pod holds its app and a sidecar proxy, on two nodes with the network under them; the control plane, a pod of its own on node 1, pushes config to the proxies. A `send` shows its movement as a small token (the default), as an arrow that draws itself from source to target (`send arrow`), or both (`send both`); an LLM reads each the same way, as `a -> b: label` under the step. `family app "apps"` names a family in the setup and `is=app` gives a thing, a connector or a send its colour: each family gets one colour from a fixed palette (a soft fill, a line, an ink for words), the same on every shape, arrow, token and chip, in light and dark, with a legend above the stage. A send takes the colour of the thing it starts from.

```animation layout=row
family app "apps"
family proxy "sidecar proxies"
family net "network cards and the network"
family ctl "control plane"
group n1 "node 1" layout=column note="node IP 198.51.100.21"
group cp "control plane" in n1 is=ctl
box cfg "mesh config" in cp is=ctl note="holds the mesh's rules and pushes them to the proxies; it runs in a pod of its own, here on node 1"
group pa "pod: orders" in n1 layout=row
box a "orders app" in pa is=app
box pxa "proxy" in pa is=proxy note="the orders pod's sidecar; pod IP 198.51.100.4"
box e1 "network card" in n1 is=net note="eth0, node 1's network card"
box net "the network" is=net note="the network under the cluster: it carries the bytes from node to node and only ever sees them encrypted"
group n2 "node 2" layout=column note="node IP 198.51.100.22"
box e2 "network card" in n2 is=net note="eth0, node 2's network card"
group pb "pod: payments" in n2 layout=row
box pxb "proxy" in pb is=proxy note="the payments pod's sidecar; pod IP 198.51.100.7"
box b "payments app" in pb is=app
e1 -> net
net -> e2
@step Each pod runs its app and a sidecar proxy. The app talks only to its own proxy: pay order 7.
send both a -> pxa
@step The orders proxy encrypts the call with mutual TLS and sends it from its pod's IP, out through node 1's network card.
send both "encrypted" pxa -> e1
@step The network under the cluster carries the encrypted bytes toward node 2. It cannot read them.
send "encrypted" e1 -> net
@step It delivers them to node 2's network card.
send net -> e2
@step Node 2 hands them to the payments proxy, which decrypts the call. Each side has proved who it is.
send both "pay order 7" e2 -> pxb
@step The payments proxy hands "pay order 7" to its app. Neither app sees the encryption.
send both pxb -> b
@step The control plane pushes a new rule to the orders proxy: retry twice. No app changes.
send arrow "retry: 2" cfg -> pxa
say pxa: retries twice on failure
@step A call fails once at the payments app.
highlight b tone=hot
say b: failed once
@step The orders proxy retries by itself, out through node 1's card again.
send both "retry" pxa -> e1
@step Across the network, still encrypted.
send "retry" e1 -> net
@step Into node 2's card.
send "retry" net -> e2
@step To the payments proxy, which decrypts it.
send e2 -> pxb
@step This time the payments app takes the call.
send both pxb -> b
```

:::llm
Animation, 13 steps, flat. Node 1 (the control plane's mesh config; pod orders: the orders app and its proxy; node 1's network card), the network under the cluster, node 2 (pod payments: its proxy and the payments app; node 2's network card).

1. to 6. The orders app calls its own proxy; the proxy encrypts the call with mutual TLS and sends it out of node 1's card, across the network, into node 2's card, to the payments proxy, which decrypts it and hands it to its app.
7. The control plane pushes "retry twice" to the orders proxy. No app changes.
8. A call fails once at the payments app.
9. to 13. The orders proxy retries by itself on the same path; the payments app takes the second try.
:::

:::accordion
#### Source: `fixtures/format/53-animation-a-service-mesh.dh.md`
````text
---
title: "Animation: a service mesh"
description: A fixture made from the Format page section of the same name.
---

## Animation: a service mesh

Each pod holds its app and a sidecar proxy, on two nodes with the network under them; the control plane, a pod of its own on node 1, pushes config to the proxies. A `send` shows its movement as a small token (the default), as an arrow that draws itself from source to target (`send arrow`), or both (`send both`); an LLM reads each the same way, as `a -> b: label` under the step. `family app "apps"` names a family in the setup and `is=app` gives a thing, a connector or a send its colour: each family gets one colour from a fixed palette (a soft fill, a line, an ink for words), the same on every shape, arrow, token and chip, in light and dark, with a legend above the stage. A send takes the colour of the thing it starts from.

```animation layout=row
family app "apps"
family proxy "sidecar proxies"
family net "network cards and the network"
family ctl "control plane"
group n1 "node 1" layout=column note="node IP 198.51.100.21"
group cp "control plane" in n1 is=ctl
box cfg "mesh config" in cp is=ctl note="holds the mesh's rules and pushes them to the proxies; it runs in a pod of its own, here on node 1"
group pa "pod: orders" in n1 layout=row
box a "orders app" in pa is=app
box pxa "proxy" in pa is=proxy note="the orders pod's sidecar; pod IP 198.51.100.4"
box e1 "network card" in n1 is=net note="eth0, node 1's network card"
box net "the network" is=net note="the network under the cluster: it carries the bytes from node to node and only ever sees them encrypted"
group n2 "node 2" layout=column note="node IP 198.51.100.22"
box e2 "network card" in n2 is=net note="eth0, node 2's network card"
group pb "pod: payments" in n2 layout=row
box pxb "proxy" in pb is=proxy note="the payments pod's sidecar; pod IP 198.51.100.7"
box b "payments app" in pb is=app
e1 -> net
net -> e2
@step Each pod runs its app and a sidecar proxy. The app talks only to its own proxy: pay order 7.
send both a -> pxa
@step The orders proxy encrypts the call with mutual TLS and sends it from its pod's IP, out through node 1's network card.
send both "encrypted" pxa -> e1
@step The network under the cluster carries the encrypted bytes toward node 2. It cannot read them.
send "encrypted" e1 -> net
@step It delivers them to node 2's network card.
send net -> e2
@step Node 2 hands them to the payments proxy, which decrypts the call. Each side has proved who it is.
send both "pay order 7" e2 -> pxb
@step The payments proxy hands "pay order 7" to its app. Neither app sees the encryption.
send both pxb -> b
@step The control plane pushes a new rule to the orders proxy: retry twice. No app changes.
send arrow "retry: 2" cfg -> pxa
say pxa: retries twice on failure
@step A call fails once at the payments app.
highlight b tone=hot
say b: failed once
@step The orders proxy retries by itself, out through node 1's card again.
send both "retry" pxa -> e1
@step Across the network, still encrypted.
send "retry" e1 -> net
@step Into node 2's card.
send "retry" net -> e2
@step To the payments proxy, which decrypts it.
send e2 -> pxb
@step This time the payments app takes the call.
send both pxb -> b
```

:::llm
Animation, 13 steps, flat. Node 1 (the control plane's mesh config; pod orders: the orders app and its proxy; node 1's network card), the network under the cluster, node 2 (pod payments: its proxy and the payments app; node 2's network card).

1. to 6. The orders app calls its own proxy; the proxy encrypts the call with mutual TLS and sends it out of node 1's card, across the network, into node 2's card, to the payments proxy, which decrypts it and hands it to its app.
7. The control plane pushes "retry twice" to the orders proxy. No app changes.
8. A call fails once at the payments app.
9. to 13. The orders proxy retries by itself on the same path; the payments app takes the second try.
:::
````
:::


## Animation: not only code

The same entities tell any story: how a bill becomes a law (in the United States, simplified).

```animation dir=down
person rep "member of the House"
group house "House"
group senate "Senate"
person pres "President"
box law "law"
rep -> house
house -> senate
senate -> pres
pres -> law
token bill "bill" at rep
@step A member of the House writes a bill and introduces it.
highlight rep
@step A House committee studies it; then the whole House votes, and a majority passes it.
move bill to house
add pill hc "committee" in house
add pill hv "vote: passed" in house tone=good
@step The Senate does the same: its own committee, its own vote.
move bill to senate
add pill sc "committee" in senate
add pill sv "vote: passed" in senate tone=good
@step The President signs it.
move bill to pres
say pres: signed
@step The bill is now a law.
move bill to law
set law tone=good
```

:::accordion
#### Source: `fixtures/format/54-animation-not-only-code.dh.md`
````text
---
title: "Animation: not only code"
description: A fixture made from the Format page section of the same name.
---

## Animation: not only code

The same entities tell any story: how a bill becomes a law (in the United States, simplified).

```animation dir=down
person rep "member of the House"
group house "House"
group senate "Senate"
person pres "President"
box law "law"
rep -> house
house -> senate
senate -> pres
pres -> law
token bill "bill" at rep
@step A member of the House writes a bill and introduces it.
highlight rep
@step A House committee studies it; then the whole House votes, and a majority passes it.
move bill to house
add pill hc "committee" in house
add pill hv "vote: passed" in house tone=good
@step The Senate does the same: its own committee, its own vote.
move bill to senate
add pill sc "committee" in senate
add pill sv "vote: passed" in senate tone=good
@step The President signs it.
move bill to pres
say pres: signed
@step The bill is now a law.
move bill to law
set law tone=good
```
````
:::


## Animation: colour families, the way a diagram uses them

Colour marks what a thing *is*, and words stay readable: a family's colour goes on the border, the lines and the dots, with a light tint inside (`fill=soft`, the default) or none (`fill=none`, the border only); the words are always in ink. A container can be one family and hold things of other families: each keeps its own colour. A thing of the same family as its container drops the tint, so it stands out. Set `fill=` on one thing, or on the whole scene (`` ```animation fill=none ``). Here, letters go from post boxes (border only) through a sorting centre (one family) whose two machines are two other families.

```animation
family box "post boxes"
family sort "sorting centres"
family a "machine A"
family b "machine B"
family van "vans"
group boxes "post boxes" layout=column
box p1 "Hill Road" in boxes is=box fill=none
box p2 "Lake Street" in boxes is=box fill=none
box p3 "Market Square" in boxes is=box fill=none
group c1 "north centre" layout=row is=sort
box c1a "machine A" in c1 is=a size=s
box c1b "machine B" in c1 is=b size=s
group c2 "south centre" layout=row is=sort
box c2a "machine A" in c2 is=a size=s
box c2b "machine B" in c2 is=b size=s
group vans "vans" layout=column is=van
box v1 "van 1" in vans is=van
box v2 "van 2" in vans is=van
cylinder po "post office" is=van
p1 --> c1 is=box
p2 --> c1 is=box
p3 --> c2 is=box
c1 --> v1 is=sort
c2 --> v2 is=sort
v1 --> po is=van
v2 --> po is=van
@step Letters wait in three post boxes. The colours say what each thing is; the words stay in ink.
@step A collection takes the Hill Road letters to the north centre.
send "letters" p1 -> c1
@step Machine A reads the addresses. Machine B, another family inside the same centre, stands by.
highlight c1a
set c1b dim=yes
@step Machine A breaks down, and machine B takes over.
set c1a down=yes
set c1b dim=no
highlight c1b tone=good
@step The sorted letters go out to van 1.
send arrow "sorted" c1 -> v1
@step Van 1 takes them to the post office.
send both "delivery" v1 -> po
```

:::accordion
#### Source: `fixtures/format/55-animation-colour-families-the-way-a-diagram-uses-them.dh.md`
````text
---
title: "Animation: colour families, the way a diagram uses them"
description: A fixture made from the Format page section of the same name.
---

## Animation: colour families, the way a diagram uses them

Colour marks what a thing *is*, and words stay readable: a family's colour goes on the border, the lines and the dots, with a light tint inside (`fill=soft`, the default) or none (`fill=none`, the border only); the words are always in ink. A container can be one family and hold things of other families: each keeps its own colour. A thing of the same family as its container drops the tint, so it stands out. Set `fill=` on one thing, or on the whole scene (`` ```animation fill=none ``). Here, letters go from post boxes (border only) through a sorting centre (one family) whose two machines are two other families.

```animation
family box "post boxes"
family sort "sorting centres"
family a "machine A"
family b "machine B"
family van "vans"
group boxes "post boxes" layout=column
box p1 "Hill Road" in boxes is=box fill=none
box p2 "Lake Street" in boxes is=box fill=none
box p3 "Market Square" in boxes is=box fill=none
group c1 "north centre" layout=row is=sort
box c1a "machine A" in c1 is=a size=s
box c1b "machine B" in c1 is=b size=s
group c2 "south centre" layout=row is=sort
box c2a "machine A" in c2 is=a size=s
box c2b "machine B" in c2 is=b size=s
group vans "vans" layout=column is=van
box v1 "van 1" in vans is=van
box v2 "van 2" in vans is=van
cylinder po "post office" is=van
p1 --> c1 is=box
p2 --> c1 is=box
p3 --> c2 is=box
c1 --> v1 is=sort
c2 --> v2 is=sort
v1 --> po is=van
v2 --> po is=van
@step Letters wait in three post boxes. The colours say what each thing is; the words stay in ink.
@step A collection takes the Hill Road letters to the north centre.
send "letters" p1 -> c1
@step Machine A reads the addresses. Machine B, another family inside the same centre, stands by.
highlight c1a
set c1b dim=yes
@step Machine A breaks down, and machine B takes over.
set c1a down=yes
set c1b dim=no
highlight c1b tone=good
@step The sorted letters go out to van 1.
send arrow "sorted" c1 -> v1
@step Van 1 takes them to the post office.
send both "delivery" v1 -> po
```
````
:::


## Animation: eight colours, told apart by everyone

A scene can name up to eight families, and any two of them can stand side by side, so the eight colours are chosen by measurement, not by taste alone. Every pair differs in its **border** and in its **fill**, with normal sight and with the two common kinds of colour blindness (red-blind and green-blind, protanopia and deuteranopia, simulated). Every border is at least 3:1 against the stage and against any container it sits in; every word is at least 4.5:1 against what it sits on. A family has one fill for its boxes and its groups alike, and every border is at least 3:1 on any other family's fill, so a box of one family inside a group of another is still easy to see (one measured exception in light: the yellow family's olive border is 2.5:1 on the lilac, pink and green fills, where its own yellow fill marks its edge too). In dark a family writes its words in a light tint of its own colour. Light and dark each have their own eight, measured on their own backgrounds. Here all eight families share one scene, in two steps: one region (the services' family) holds things of four other families, and a worker of a fifth reads its queue from outside.

```animation
family user "people"
family edge "the edge"
family web "web servers"
family api "services"
family queue "queues"
family worker "workers"
family store "databases"
family cache "caches"
person u "reader" is=user
box cdn "CDN" is=edge
group region "one region" layout=row is=api
box w1 "web" in region is=web
box s1 "orders service" in region is=api
box q1 "orders queue" in region is=queue
box k1 "worker" is=worker
cylinder db "orders DB" in region is=store
box c1 "cache" in region is=cache
u -> cdn is=user
cdn -> w1 is=edge
w1 -> s1 is=web
s1 -> q1 is=api
q1 -> k1 is=queue
k1 -> db is=worker
s1 -> c1 is=api
@step Eight families on one stage: each has its own border and its own fill.
@step The services' region holds four other families; the worker of a fifth reads its queue from outside.
```

Which colour a family gets is the theme's business: the source names families and roles, never a colour value. A host restyles the palette with the tokens `--c1` to `--c8` (border and lines), `--c1-soft` (the fill of its boxes and groups alike; `--c1-plane` names the same colour) and `--c1-ink` (words in the family's colour), and the stage's own edges with `--scn-edge`, `--scn-frame-edge` and `--scn-band-edge`.

:::accordion
#### Source: `fixtures/format/55a-animation-eight-colours-told-apart-by-everyone.dh.md`
````text
---
title: "Animation: eight colours, told apart by everyone"
description: A fixture made from the Format page section of the same name.
---

## Animation: eight colours, told apart by everyone

A scene can name up to eight families, and any two of them can stand side by side, so the eight colours are chosen by measurement, not by taste alone. Every pair differs in its **border** and in its **fill**, with normal sight and with the two common kinds of colour blindness (red-blind and green-blind, protanopia and deuteranopia, simulated). Every border is at least 3:1 against the stage and against any container it sits in; every word is at least 4.5:1 against what it sits on. A family has one fill for its boxes and its groups alike, and every border is at least 3:1 on any other family's fill, so a box of one family inside a group of another is still easy to see (one measured exception in light: the yellow family's olive border is 2.5:1 on the lilac, pink and green fills, where its own yellow fill marks its edge too). In dark a family writes its words in a light tint of its own colour. Light and dark each have their own eight, measured on their own backgrounds. Here all eight families share one scene, in two steps: one region (the services' family) holds things of four other families, and a worker of a fifth reads its queue from outside.

```animation
family user "people"
family edge "the edge"
family web "web servers"
family api "services"
family queue "queues"
family worker "workers"
family store "databases"
family cache "caches"
person u "reader" is=user
box cdn "CDN" is=edge
group region "one region" layout=row is=api
box w1 "web" in region is=web
box s1 "orders service" in region is=api
box q1 "orders queue" in region is=queue
box k1 "worker" is=worker
cylinder db "orders DB" in region is=store
box c1 "cache" in region is=cache
u -> cdn is=user
cdn -> w1 is=edge
w1 -> s1 is=web
s1 -> q1 is=api
q1 -> k1 is=queue
k1 -> db is=worker
s1 -> c1 is=api
@step Eight families on one stage: each has its own border and its own fill.
@step The services' region holds four other families; the worker of a fifth reads its queue from outside.
```

Which colour a family gets is the theme's business: the source names families and roles, never a colour value. A host restyles the palette with the tokens `--c1` to `--c8` (border and lines), `--c1-soft` (the fill of its boxes and groups alike; `--c1-plane` names the same colour) and `--c1-ink` (words in the family's colour), and the stage's own edges with `--scn-edge`, `--scn-frame-edge` and `--scn-band-edge`.
````
:::


## Animation: streams, meters and colours

A `send stream` keeps small dots flowing along a path for the whole step: traffic, a feed, readings. `level=0..100` puts a meter in a thing, and `set x level=` moves it. Here, weather stations stream readings to a hub, which batches them into a store; the hub's buffer fills and empties.

```animation
family st "stations"
family hub "the hub"
family store "the store"
group field "stations" layout=column
box s1 "hill station" in field is=st
box s2 "lake station" in field is=st
box s3 "city station" in field is=st
box hub "hub" is=hub level=10 note="keeps readings until it has a full batch"
cylinder db "readings store" is=store level=20 note="its meter: how full it is"
s1 -> hub
s2 -> hub
s3 -> hub
hub -> db
@step Three stations send a reading every few seconds. The hub keeps them in a buffer.
send stream s1 -> hub
send stream s2 -> hub
send stream s3 -> hub
set hub level=45
@step A storm: the hill station sends ten times as often, and the buffer fills.
send stream "storm: every second" s1 -> hub
send stream s2 -> hub
send stream s3 -> hub
set hub level=90 tone=warn
@step The buffer is full: the hub writes one batch to the store and empties.
send arrow "batch of 600" hub -> db
set hub level=5 tone=plain
set db level=40
@step Readings keep coming. When the buffer is full again, the next batch goes in: the store grows by a batch at a time.
send stream s1 -> hub
send stream s2 -> hub
send stream s3 -> hub
set hub level=90
then
send arrow "next batch" hub -> db
set hub level=5
set db level=60
```

:::accordion
#### Source: `fixtures/format/56-animation-streams-meters-and-colours.dh.md`
````text
---
title: "Animation: streams, meters and colours"
description: A fixture made from the Format page section of the same name.
---

## Animation: streams, meters and colours

A `send stream` keeps small dots flowing along a path for the whole step: traffic, a feed, readings. `level=0..100` puts a meter in a thing, and `set x level=` moves it. Here, weather stations stream readings to a hub, which batches them into a store; the hub's buffer fills and empties.

```animation
family st "stations"
family hub "the hub"
family store "the store"
group field "stations" layout=column
box s1 "hill station" in field is=st
box s2 "lake station" in field is=st
box s3 "city station" in field is=st
box hub "hub" is=hub level=10 note="keeps readings until it has a full batch"
cylinder db "readings store" is=store level=20 note="its meter: how full it is"
s1 -> hub
s2 -> hub
s3 -> hub
hub -> db
@step Three stations send a reading every few seconds. The hub keeps them in a buffer.
send stream s1 -> hub
send stream s2 -> hub
send stream s3 -> hub
set hub level=45
@step A storm: the hill station sends ten times as often, and the buffer fills.
send stream "storm: every second" s1 -> hub
send stream s2 -> hub
send stream s3 -> hub
set hub level=90 tone=warn
@step The buffer is full: the hub writes one batch to the store and empties.
send arrow "batch of 600" hub -> db
set hub level=5 tone=plain
set db level=40
@step Readings keep coming. When the buffer is full again, the next batch goes in: the store grows by a batch at a time.
send stream s1 -> hub
send stream s2 -> hub
send stream s3 -> hub
set hub level=90
then
send arrow "next batch" hub -> db
set hub level=5
set db level=60
```
````
:::


## Animation: a balancer evens out the load

Meters on several things show a balance changing step by step. Here, a kitchen's three cooks get orders; a pass moves orders from the busiest cook to the least busy one.

```animation dir=down
family pass "the pass"
family cook "cooks"
box pass "the pass" is=pass note="the counter where orders are handed out"
group line "the line" layout=row
box c1 "grill" in line is=cook level=90
box c2 "salads" in line is=cook level=20
box c3 "pasta" in line is=cook level=40
pass -> c1
pass -> c2
pass -> c3
@step Orders pile up at the grill; the salad cook is nearly idle.
highlight c1 tone=hot
@step The pass sends the next two orders to the salad cook instead.
send both "2 orders" pass -> c2
set c2 level=45
@step The grill finishes what it had, and gets nothing new until it catches up.
set c1 level=60
@step The load is even: the three cooks now have about the same amount of work.
set c1 level=50
set c3 level=45
highlight c1 c2 c3 tone=good
```

:::accordion
#### Source: `fixtures/format/57-animation-a-balancer-evens-out-the-load.dh.md`
````text
---
title: "Animation: a balancer evens out the load"
description: A fixture made from the Format page section of the same name.
---

## Animation: a balancer evens out the load

Meters on several things show a balance changing step by step. Here, a kitchen's three cooks get orders; a pass moves orders from the busiest cook to the least busy one.

```animation dir=down
family pass "the pass"
family cook "cooks"
box pass "the pass" is=pass note="the counter where orders are handed out"
group line "the line" layout=row
box c1 "grill" in line is=cook level=90
box c2 "salads" in line is=cook level=20
box c3 "pasta" in line is=cook level=40
pass -> c1
pass -> c2
pass -> c3
@step Orders pile up at the grill; the salad cook is nearly idle.
highlight c1 tone=hot
@step The pass sends the next two orders to the salad cook instead.
send both "2 orders" pass -> c2
set c2 level=45
@step The grill finishes what it had, and gets nothing new until it catches up.
set c1 level=60
@step The load is even: the three cooks now have about the same amount of work.
set c1 level=50
set c3 level=45
highlight c1 c2 c3 tone=good
```
````
:::


## Animation: one question becomes three

`split` and `merge` with arrows show one request fanning out and coming back together. Here, a library search asks three branch catalogues at once and merges their answers.

```animation
family q "the question"
family br "branch catalogues"
pill ask "find: tide tables" is=q
box planner "planner" is=q note="splits a search by branch"
group branches "branches" layout=column
cylinder b1 "north branch" in branches is=br
cylinder b2 "harbour branch" in branches is=br
cylinder b3 "old town branch" in branches is=br
box merge "merger" is=q
ask -> planner
planner -> b1
planner -> b2
planner -> b3
b1 -> merge
b2 -> merge
b3 -> merge
@step A reader asks for tide tables. The planner sees that three branches keep them.
send arrow ask -> planner
@step The planner asks all three branches at once.
send arrow "same question" planner -> b1
send arrow planner -> b2
send arrow planner -> b3
@step Each branch answers with what it has; the old town branch has nothing.
send both "2 books" b1 -> merge
send both "5 books" b2 -> merge
set b3 dim=yes
@step The merger joins the answers into one list for the reader.
highlight merge
say merge below: 7 books, by date
```

:::accordion
#### Source: `fixtures/format/58-animation-one-question-becomes-three.dh.md`
````text
---
title: "Animation: one question becomes three"
description: A fixture made from the Format page section of the same name.
---

## Animation: one question becomes three

`split` and `merge` with arrows show one request fanning out and coming back together. Here, a library search asks three branch catalogues at once and merges their answers.

```animation
family q "the question"
family br "branch catalogues"
pill ask "find: tide tables" is=q
box planner "planner" is=q note="splits a search by branch"
group branches "branches" layout=column
cylinder b1 "north branch" in branches is=br
cylinder b2 "harbour branch" in branches is=br
cylinder b3 "old town branch" in branches is=br
box merge "merger" is=q
ask -> planner
planner -> b1
planner -> b2
planner -> b3
b1 -> merge
b2 -> merge
b3 -> merge
@step A reader asks for tide tables. The planner sees that three branches keep them.
send arrow ask -> planner
@step The planner asks all three branches at once.
send arrow "same question" planner -> b1
send arrow planner -> b2
send arrow planner -> b3
@step Each branch answers with what it has; the old town branch has nothing.
send both "2 books" b1 -> merge
send both "5 books" b2 -> merge
set b3 dim=yes
@step The merger joins the answers into one list for the reader.
highlight merge
say merge below: 7 books, by date
```
````
:::


## Animation: the author sets the beat

Format version 9 gives the author more say over motion, still with no times or pixels. `then` starts the next beat of a step: what comes after it waits for what came before. `pace slow` or `pace fast` sets a step's speed. `spotlight` dims everything else for one step. `say cache below: …` says where the speech goes. `path=arc` makes a move travel over an arc. Things a step does not change never move.

```animation
family app "the app"
family data "data"
person u "reader"
group app "web app" layout=column is=app
box h "handler" in app is=app
box cache "cache" is=data
cylinder db "database" is=data
group tray "pages ready" layout=row
u -> app
app -> cache
app -> db
@step A reader asks the web app for a page.
send "GET /a" u -> app
@step The app looks in the cache; then the cache answers.
spotlight app cache
send "find /a" app -> cache
then
say cache below: not here
@step So the app reads the database. The pace is slow, so the wait shows.
pace slow
send "read /a" app -> db
@step The handler builds the page; then it moves over to the pages that are ready.
add box page "page /a" in app is=app
then
move page to tray path=arc
```

:::accordion
#### Source: `fixtures/format/59-animation-the-author-sets-the-beat.dh.md`
````text
---
title: "Animation: the author sets the beat"
description: A fixture made from the Format page section of the same name.
---

## Animation: the author sets the beat

Format version 9 gives the author more say over motion, still with no times or pixels. `then` starts the next beat of a step: what comes after it waits for what came before. `pace slow` or `pace fast` sets a step's speed. `spotlight` dims everything else for one step. `say cache below: …` says where the speech goes. `path=arc` makes a move travel over an arc. Things a step does not change never move.

```animation
family app "the app"
family data "data"
person u "reader"
group app "web app" layout=column is=app
box h "handler" in app is=app
box cache "cache" is=data
cylinder db "database" is=data
group tray "pages ready" layout=row
u -> app
app -> cache
app -> db
@step A reader asks the web app for a page.
send "GET /a" u -> app
@step The app looks in the cache; then the cache answers.
spotlight app cache
send "find /a" app -> cache
then
say cache below: not here
@step So the app reads the database. The pace is slow, so the wait shows.
pace slow
send "read /a" app -> db
@step The handler builds the page; then it moves over to the pages that are ready.
add box page "page /a" in app is=app
then
move page to tray path=arc
```
````
:::


## Animation by a new author: a queue with workers

Written from the spec alone by a helper that had not seen the engine; doccheck passed it on the first try.

```animation
box api "API"
queue q "jobs"
group w1 "worker 1" layout=row
group w2 "worker 2" layout=row
api -> q
q -> w1
q -> w2
@step The API adds three jobs to the queue.
push q "job 1" as j1
push q "job 2" as j2
push q "job 3" as j3
@step Worker 1 takes the oldest job from the front.
pop q to w1
@step Worker 2 takes the next job.
pop q to w2
@step Worker 1 finishes job 1, so the job is gone.
remove j1
say w1: done!
@step Worker 1 takes the next job in line.
pop q to w1
@step The API keeps adding work while the workers run.
push q "job 4" as j4
```

:::accordion
#### Source: `fixtures/format/60-animation-by-a-new-author-a-queue-with-workers.dh.md`
````text
---
title: "Animation by a new author: a queue with workers"
description: A fixture made from the Format page section of the same name.
---

## Animation by a new author: a queue with workers

Written from the spec alone by a helper that had not seen the engine; doccheck passed it on the first try.

```animation
box api "API"
queue q "jobs"
group w1 "worker 1" layout=row
group w2 "worker 2" layout=row
api -> q
q -> w1
q -> w2
@step The API adds three jobs to the queue.
push q "job 1" as j1
push q "job 2" as j2
push q "job 3" as j3
@step Worker 1 takes the oldest job from the front.
pop q to w1
@step Worker 2 takes the next job.
pop q to w2
@step Worker 1 finishes job 1, so the job is gone.
remove j1
say w1: done!
@step Worker 1 takes the next job in line.
pop q to w1
@step The API keeps adding work while the workers run.
push q "job 4" as j4
```
````
:::


## Animation by a new author: a CDN miss, then a hit

The second scene from the same first try.

```animation
person u1 "user 1"
group edge "CDN edge" layout=row
cylinder origin "origin server" note="holds the original file"
u1 <-> edge
edge <-> origin
@step User 1 asks the CDN edge for logo.png.
send "GET logo.png" u1 -> edge
@step The edge has no copy: a miss.
say edge: Miss!
highlight edge tone=warn
@step The edge fetches the file from the origin server.
send "GET logo.png" edge -> origin
camera edge origin
@step The origin answers, and the edge keeps a copy.
send "logo.png" origin -> edge
add box copy "logo.png" in edge
@step The edge answers user 1.
send "logo.png" edge -> u1
camera all
@step User 2 asks the edge for the same file.
add person u2 "user 2"
u2 <-> edge
send "GET logo.png" u2 -> edge
@step The edge has a copy: a hit. It answers at once, with no trip to the origin.
say edge: Hit!
highlight copy tone=good
send "logo.png" edge -> u2
camera edge u2
```

:::accordion
#### Source: `fixtures/format/61-animation-by-a-new-author-a-cdn-miss-then-a-hit.dh.md`
````text
---
title: "Animation by a new author: a CDN miss, then a hit"
description: A fixture made from the Format page section of the same name.
---

## Animation by a new author: a CDN miss, then a hit

The second scene from the same first try.

```animation
person u1 "user 1"
group edge "CDN edge" layout=row
cylinder origin "origin server" note="holds the original file"
u1 <-> edge
edge <-> origin
@step User 1 asks the CDN edge for logo.png.
send "GET logo.png" u1 -> edge
@step The edge has no copy: a miss.
say edge: Miss!
highlight edge tone=warn
@step The edge fetches the file from the origin server.
send "GET logo.png" edge -> origin
camera edge origin
@step The origin answers, and the edge keeps a copy.
send "logo.png" origin -> edge
add box copy "logo.png" in edge
@step The edge answers user 1.
send "logo.png" edge -> u1
camera all
@step User 2 asks the edge for the same file.
add person u2 "user 2"
u2 <-> edge
send "GET logo.png" u2 -> edge
@step The edge has a copy: a hit. It answers at once, with no trip to the origin.
say edge: Hit!
highlight copy tone=good
send "logo.png" edge -> u2
camera edge u2
```
````
:::


## Animation: one thing splits, travels and merges

A token can be cut into pieces and put back together. `split f into 3 "part"` makes three tokens, `f.1` to `f.3` ("part 1" to "part 3"), where `f` was. `move f.1 f.2 f.3 into b` moves them together, as one hop. `merge f` puts the pieces back into `f`. A token can sit at a thing (`token t "req" at api`) or wait in a container (`token f "photo.jpg" in a`).

```animation
group a "sender" layout=column
group b "receiver" layout=column
a -> b
token f "photo.jpg" in a
@step The sender has a file that is too big for one packet.
highlight f
@step It is split into three parts.
split f into 3 "part"
@step The parts travel together: one hop.
move f.1 f.2 f.3 into b
@step The receiver joins them back into the file.
merge f
```

:::accordion
#### Source: `fixtures/format/62-animation-one-thing-splits-travels-and-merges.dh.md`
````text
---
title: "Animation: one thing splits, travels and merges"
description: A fixture made from the Format page section of the same name.
---

## Animation: one thing splits, travels and merges

A token can be cut into pieces and put back together. `split f into 3 "part"` makes three tokens, `f.1` to `f.3` ("part 1" to "part 3"), where `f` was. `move f.1 f.2 f.3 into b` moves them together, as one hop. `merge f` puts the pieces back into `f`. A token can sit at a thing (`token t "req" at api`) or wait in a container (`token f "photo.jpg" in a`).

```animation
group a "sender" layout=column
group b "receiver" layout=column
a -> b
token f "photo.jpg" in a
@step The sender has a file that is too big for one packet.
highlight f
@step It is split into three parts.
split f into 3 "part"
@step The parts travel together: one hop.
move f.1 f.2 f.3 into b
@step The receiver joins them back into the file.
merge f
```
````
:::


## Animation: an array, a map and a tree in one scene

Data structures are things like any other, and live in one scene with a person, a service and a database. Each is `closed=yes`: small and faint until the story zooms into it. `map cart "cart sizes" buckets=3: ana: 3, ...` is a map of keys and values, drawn as a hash table: a key's bucket is the sum of its letters' codes, mod 3. `get cart ana` looks a key up (its entry lights up, and its bucket is framed), `get ids 3` reads an array by index, and `put cart dee: 4` adds an entry. `dir=down` on the fence runs the scene top to bottom. Without `buckets=`, a map is a table of keys and values.

```animation dir=down size=s
family svc "the service"
family data "its data"
person ana "Ana"
group api "orders service" layout=row is=svc
array ids "sorted ids" in api closed=yes is=data: 12, 19, 27, 34
map cart "cart sizes" in api buckets=3 closed=yes is=data: ana: 3, ben: 7, cy: 9
tree idx "price index" in api closed=yes is=data
pill p30 "30" in idx
pill p20 "20" in idx under p30 left
pill p50 "50" in idx under p30 right
pill p40 "40" in idx under p50 left
cylinder db "orders database"
ana -> api
api -> db
@step Ana asks for her orders. The service keeps three structures in memory.
say ana: my orders, please
@step Zoom into the array: four ids, sorted.
zoom into ids
@step Index 3 is read at once: 34. No search.
get ids 3
@step Now the map. A key's bucket: the sum of its letters' codes, mod 3.
zoom out
then
zoom into cart
@step ana goes to bucket 1, which cy shares (a chain). Its value: 3 items.
get cart ana
@step A new key, dee, goes to bucket 2.
put cart dee: 4
@step Now the tree: smaller prices go left, bigger right.
zoom out
then
zoom into idx
@step Find 40: at the root, 30, go right.
highlight p30
@step At 50, go left.
highlight p50
@step 40 is found.
highlight p40 tone=good
@step Back out: the service answered from memory, not the database.
zoom out
say ana: that was fast
```

:::accordion
#### Source: `fixtures/format/63-animation-an-array-a-map-and-a-tree-in-one-scene.dh.md`
````text
---
title: "Animation: an array, a map and a tree in one scene"
description: A fixture made from the Format page section of the same name.
---

## Animation: an array, a map and a tree in one scene

Data structures are things like any other, and live in one scene with a person, a service and a database. Each is `closed=yes`: small and faint until the story zooms into it. `map cart "cart sizes" buckets=3: ana: 3, ...` is a map of keys and values, drawn as a hash table: a key's bucket is the sum of its letters' codes, mod 3. `get cart ana` looks a key up (its entry lights up, and its bucket is framed), `get ids 3` reads an array by index, and `put cart dee: 4` adds an entry. `dir=down` on the fence runs the scene top to bottom. Without `buckets=`, a map is a table of keys and values.

```animation dir=down size=s
family svc "the service"
family data "its data"
person ana "Ana"
group api "orders service" layout=row is=svc
array ids "sorted ids" in api closed=yes is=data: 12, 19, 27, 34
map cart "cart sizes" in api buckets=3 closed=yes is=data: ana: 3, ben: 7, cy: 9
tree idx "price index" in api closed=yes is=data
pill p30 "30" in idx
pill p20 "20" in idx under p30 left
pill p50 "50" in idx under p30 right
pill p40 "40" in idx under p50 left
cylinder db "orders database"
ana -> api
api -> db
@step Ana asks for her orders. The service keeps three structures in memory.
say ana: my orders, please
@step Zoom into the array: four ids, sorted.
zoom into ids
@step Index 3 is read at once: 34. No search.
get ids 3
@step Now the map. A key's bucket: the sum of its letters' codes, mod 3.
zoom out
then
zoom into cart
@step ana goes to bucket 1, which cy shares (a chain). Its value: 3 items.
get cart ana
@step A new key, dee, goes to bucket 2.
put cart dee: 4
@step Now the tree: smaller prices go left, bigger right.
zoom out
then
zoom into idx
@step Find 40: at the root, 30, go right.
highlight p30
@step At 50, go left.
highlight p50
@step 40 is found.
highlight p40 tone=good
@step Back out: the service answered from memory, not the database.
zoom out
say ana: that was fast
```
````
:::


## 3D: the stateless replay system in layers

Format version 5 adds **layers**. `layer co "coordinator"` declares one (the first is the top), and `layer=co` puts a thing on it; a thing without `layer=` sits on its container's layer. `split layers` pulls the layers apart, `stack layers` puts them back, and `focus tc` flies the camera to one layer while the others fade. A fence written `` ```animation 3d `` opens the scene in 3D; the **2D/3D** button on every stage switches and keeps the step. In 3D: drag to turn; right-drag, Shift + drag or two fingers to move; the wheel, a pinch or + and − to zoom; once you click the stage, the arrow keys and W A S D move too. Click a thing for its note or a layer to zoom into it; the reset button puts the camera back. Here, one call goes down from the CLI to the template container and the answer comes back up.

```animation 3d
layer you "your machine"
layer co "coordinator"
layer tc "template container"
layer reg "registry"
family you "CLI"
family co "coordinator"
family tc "template container"
family reg "registry"
group cli "CLI" layer=you layout=column is=you
text a0 "no answers yet" in cli tone=muted
box coord "coordinator" layer=co is=co note="starts templates in Docker and forwards each call"
group box1 "template container" layer=tc layout=column is=tc note="runs the script; keeps nothing"
text t0 "keeps nothing" in box1 tone=muted
cylinder img "template image" layer=reg is=reg
cli -> coord -> box1
img --> coord
@step Four layers: your CLI, the coordinator, the template container, and the registry.
split layers
@step First the coordinator pulls the template's image.
send arrow "image" img -> coord
@step It starts the template container from it.
send arrow "start" coord -> box1
@step Init call 1 goes down: the CLI calls the coordinator. It carries no answers.
send arrow "init 1 · no answers" cli -> coord
@step The coordinator forwards the call to the template container.
send arrow "init 1" coord -> box1
@step The script makes project id A and stops at its first unanswered question.
add pill p1 "project-id A" in box1 tone=acc
say box1: no answer for name
@step The question and the state go back up. The container keeps nothing.
send arrow "question: name · state: A" box1 -> coord
remove p1
@step The coordinator hands them to the CLI.
send arrow "question · state A" coord -> cli
@step The container's layer alone: no answer, no session, no paused script.
focus tc
@step You type hello-app. The CLI keeps it, and project id A.
focus all
remove a0
add pill a1 "name = hello-app" in cli tone=good
add pill a2 "project-id A" in cli tone=acc
@step Call 2 carries both down to the coordinator.
send arrow "init 2 · name, A" cli -> coord
@step It forwards call 2. The script runs again from line 1, past the name.
send arrow "init 2" coord -> box1
@step Every call goes down and back this way. Only the CLI holds the answers.
stack layers
highlight cli
```

:::accordion
#### Source: `fixtures/format/64-3d-the-stateless-replay-system-in-layers.dh.md`
````text
---
title: "3D: the stateless replay system in layers"
description: A fixture made from the Format page section of the same name.
---

## 3D: the stateless replay system in layers

Format version 5 adds **layers**. `layer co "coordinator"` declares one (the first is the top), and `layer=co` puts a thing on it; a thing without `layer=` sits on its container's layer. `split layers` pulls the layers apart, `stack layers` puts them back, and `focus tc` flies the camera to one layer while the others fade. A fence written `` ```animation 3d `` opens the scene in 3D; the **2D/3D** button on every stage switches and keeps the step. In 3D: drag to turn; right-drag, Shift + drag or two fingers to move; the wheel, a pinch or + and − to zoom; once you click the stage, the arrow keys and W A S D move too. Click a thing for its note or a layer to zoom into it; the reset button puts the camera back. Here, one call goes down from the CLI to the template container and the answer comes back up.

```animation 3d
layer you "your machine"
layer co "coordinator"
layer tc "template container"
layer reg "registry"
family you "CLI"
family co "coordinator"
family tc "template container"
family reg "registry"
group cli "CLI" layer=you layout=column is=you
text a0 "no answers yet" in cli tone=muted
box coord "coordinator" layer=co is=co note="starts templates in Docker and forwards each call"
group box1 "template container" layer=tc layout=column is=tc note="runs the script; keeps nothing"
text t0 "keeps nothing" in box1 tone=muted
cylinder img "template image" layer=reg is=reg
cli -> coord -> box1
img --> coord
@step Four layers: your CLI, the coordinator, the template container, and the registry.
split layers
@step First the coordinator pulls the template's image.
send arrow "image" img -> coord
@step It starts the template container from it.
send arrow "start" coord -> box1
@step Init call 1 goes down: the CLI calls the coordinator. It carries no answers.
send arrow "init 1 · no answers" cli -> coord
@step The coordinator forwards the call to the template container.
send arrow "init 1" coord -> box1
@step The script makes project id A and stops at its first unanswered question.
add pill p1 "project-id A" in box1 tone=acc
say box1: no answer for name
@step The question and the state go back up. The container keeps nothing.
send arrow "question: name · state: A" box1 -> coord
remove p1
@step The coordinator hands them to the CLI.
send arrow "question · state A" coord -> cli
@step The container's layer alone: no answer, no session, no paused script.
focus tc
@step You type hello-app. The CLI keeps it, and project id A.
focus all
remove a0
add pill a1 "name = hello-app" in cli tone=good
add pill a2 "project-id A" in cli tone=acc
@step Call 2 carries both down to the coordinator.
send arrow "init 2 · name, A" cli -> coord
@step It forwards call 2. The script runs again from line 1, past the name.
send arrow "init 2" coord -> box1
@step Every call goes down and back this way. Only the CLI holds the answers.
stack layers
highlight cli
```
````
:::


## 3D: Kubernetes, cluster to container

Boxes inside boxes: a cluster box holds node boxes, a node holds pod boxes, a pod holds its containers. This is a tree that only works in 3D, so the fence says `3d only` and the stage has no 2D button. Every level starts `closed=hidden`: nothing inside it is drawn until `zoom into` opens it, so each step talks about one level and the smaller boxes stay out of the way. Zooms nest (`zoom into n1`, then `zoom into p2`), and each zoom pulls the box it opens up out of the one that holds it (`lift n1`, then `lift p2`: lifts nest too). `lift k3` pulls redis up out of its pod to focus on it, `put back` sets it down again, and `zoom out` and `zoom out all` close the levels one at a time or all at once, putting each box back where it was. While a step plays, only the labels of what it touches show: here, redis alone as the camera flies to it.

```animation 3d only
group c "cluster"
group n1 "node 1" in c closed=hidden
group n2 "node 2" in c closed=hidden
group p1 "web-1" in n1 closed=hidden
group p2 "cache-1" in n1 closed=hidden
group p3 "web-2" in n2 closed=hidden
box k1 "nginx" in p1
box k2 "log agent" in p1
box k3 "redis" in p2
box k4 "nginx" in p3
box k5 "log agent" in p3
note n1: a machine; the kubelet on it runs the pods it is given
note p2: the unit the scheduler places; its containers share one network address
@step One cluster box holds two node boxes. What runs on the nodes is hidden: at this level we talk about machines.
camera all
@step Zoom into node 1: it rises out of the cluster, and its pod boxes appear, web-1 and cache-1. Node 2 fades.
zoom into n1
lift n1
camera n1
@step Zoom into cache-1: it rises out of node 1, its box opens, and its one container shows, redis.
zoom into p2
lift p2
camera p2
@step Pull redis up out of its pod to focus on it. While the camera flies in, only its label shows.
lift k3
camera k3
@step The redis container crashes.
set k3 down=yes
highlight k3 tone=hot
@step The kubelet on node 1 starts it again, back in the same pod. The pod and the node stay as they were.
put back k3
remove k3
add box k3b "redis" in p2 tone=good
camera p2
@step Zoom out to node 1: cache-1 settles back into the node and closes again; its container hides.
zoom out
@step Zoom out all the way: node 1 settles back into the cluster. The smaller boxes hide, and we are back to talking about machines.
zoom out all
```

:::accordion
#### Source: `fixtures/format/65-3d-kubernetes-cluster-to-container.dh.md`
````text
---
title: "3D: Kubernetes, cluster to container"
description: A fixture made from the Format page section of the same name.
---

## 3D: Kubernetes, cluster to container

Boxes inside boxes: a cluster box holds node boxes, a node holds pod boxes, a pod holds its containers. This is a tree that only works in 3D, so the fence says `3d only` and the stage has no 2D button. Every level starts `closed=hidden`: nothing inside it is drawn until `zoom into` opens it, so each step talks about one level and the smaller boxes stay out of the way. Zooms nest (`zoom into n1`, then `zoom into p2`), and each zoom pulls the box it opens up out of the one that holds it (`lift n1`, then `lift p2`: lifts nest too). `lift k3` pulls redis up out of its pod to focus on it, `put back` sets it down again, and `zoom out` and `zoom out all` close the levels one at a time or all at once, putting each box back where it was. While a step plays, only the labels of what it touches show: here, redis alone as the camera flies to it.

```animation 3d only
group c "cluster"
group n1 "node 1" in c closed=hidden
group n2 "node 2" in c closed=hidden
group p1 "web-1" in n1 closed=hidden
group p2 "cache-1" in n1 closed=hidden
group p3 "web-2" in n2 closed=hidden
box k1 "nginx" in p1
box k2 "log agent" in p1
box k3 "redis" in p2
box k4 "nginx" in p3
box k5 "log agent" in p3
note n1: a machine; the kubelet on it runs the pods it is given
note p2: the unit the scheduler places; its containers share one network address
@step One cluster box holds two node boxes. What runs on the nodes is hidden: at this level we talk about machines.
camera all
@step Zoom into node 1: it rises out of the cluster, and its pod boxes appear, web-1 and cache-1. Node 2 fades.
zoom into n1
lift n1
camera n1
@step Zoom into cache-1: it rises out of node 1, its box opens, and its one container shows, redis.
zoom into p2
lift p2
camera p2
@step Pull redis up out of its pod to focus on it. While the camera flies in, only its label shows.
lift k3
camera k3
@step The redis container crashes.
set k3 down=yes
highlight k3 tone=hot
@step The kubelet on node 1 starts it again, back in the same pod. The pod and the node stay as they were.
put back k3
remove k3
add box k3b "redis" in p2 tone=good
camera p2
@step Zoom out to node 1: cache-1 settles back into the node and closes again; its container hides.
zoom out
@step Zoom out all the way: node 1 settles back into the cluster. The smaller boxes hide, and we are back to talking about machines.
zoom out all
```
````
:::


## Animation: a packet through kube-proxy

Two nodes and the VPC under them, drawn flat so every word reads: each node shows its pods, its kernel and its network card, and every step is drawn at one fixed place. `layout=row` puts the nodes side by side with the VPC between them; on a phone they stack, node 1 above the VPC above node 2. The call takes the real path: the frontend's veth, node 1's kernel, where a rule kube-proxy wrote rewrites the service's virtual IP to one pod's IP (kube-proxy itself never carries the packet), node 1's network card, the VPC, node 2's network card and kernel, web-2's veth. The reply comes back the same way, and node 1's conntrack undoes the rewrite.

```animation layout=row
family pod "pods"
family kp "kube-proxy"
family kern "node kernels"
family net "network cards and the VPC"
group n1 "node 1" layout=column note="node IP 198.51.100.21"
group n1p in n1 layout=row
box fe "frontend" in n1p is=pod note="a pod; pod IP 198.51.100.4"
box kp1 "kube-proxy" in n1p is=kp note="runs on every node; watches the API for services and their pods, and writes the rules. It never carries a packet"
group n1k "kernel" in n1 layout=row is=kern
box v1 "veth" in n1k is=kern size=s note="the frontend's veth: a cable with one end in the pod and one in the node"
box r1 "rules" in n1k is=kern size=s note="the iptables rules kube-proxy wrote: every packet to 192.0.2.10 meets them"
box ct1 "conntrack" in n1k is=kern size=s note="remembers each rewrite, to undo it on the reply"
box e1 "network card" in n1 is=net note="eth0, node 1's network card"
box vr "VPC" is=net note="the network under the cluster. Its route table: 198.51.100.0/24 is local. With AWS's VPC CNI, web-2's IP 198.51.100.7 is a second address of node 2's network card"
group n2 "node 2" layout=column note="node IP 198.51.100.22"
group n2p in n2 layout=row
box w2 "web-2" in n2p is=pod note="a pod of the service web; pod IP 198.51.100.7"
box kp2 "kube-proxy" in n2p is=kp note="the same on every node"
group n2k "kernel" in n2 layout=row is=kern
box v2 "veth" in n2k is=kern size=s note="web-2's veth"
box rt2 "routes" in n2k is=kern size=s note="198.51.100.7 is a pod on this node: through web-2's veth"
box e2 "network card" in n2 is=net note="eth0, node 2's network card"
e1 -> vr
vr -> e2
@step Two nodes and the VPC, the network under them.
@step On each node: its pods at the top, its kernel, and its network card at the bottom, where packets leave and enter the node.
@step kube-proxy runs on every node. It watches the API for the service web and writes rules into the kernel's iptables. It never carries a packet.
highlight kp1
@step The frontend calls the service web at 192.0.2.10. No pod and no machine has that address: it lives only in rules.
highlight fe
@step The packet leaves the frontend through its veth, into node 1's kernel.
send fe -> v1
@step In node 1's kernel it meets the rules kube-proxy wrote. kube-proxy itself never touches the packet.
send "to 192.0.2.10" v1 -> r1
@step A rule picks one of the service's pods at random, web-2, and rewrites the destination to its IP. conntrack writes the rewrite down.
say r1 above: → 198.51.100.7
highlight r1
@step 198.51.100.7 is not on node 1, so node 1's kernel routes the packet out of its own network card.
send r1 -> e1
@step The packet enters the VPC. Its route table knows 198.51.100.7: on AWS's VPC CNI, it is an address of node 2's network card.
send "to 198.51.100.7" e1 -> vr
say vr above: 198.51.100.7 → node 2
@step The VPC delivers it to node 2's network card. No tunnel and no rewrite on the way.
send vr -> e2
@step Node 2's kernel looks up its routes: 198.51.100.7 is a pod on this node.
send e2 -> rt2
@step The route sends it into web-2's veth.
send rt2 -> v2
@step Through the veth into web-2. No second rewrite: the address is already a pod's.
send v2 -> w2
@step web-2 answers from 198.51.100.7, back into its veth.
send w2 -> v2
@step Into node 2's kernel, which routes the reply toward 198.51.100.4.
send "200 OK" v2 -> rt2
@step Out of node 2's network card.
send rt2 -> e2
@step Into the VPC: 198.51.100.4 is an address of node 1's network card.
send "200 OK" e2 -> vr
@step The VPC delivers it to node 1's network card.
send "200 OK" vr -> e1
@step Into node 1's kernel, where conntrack knows this reply: it belongs to the rewrite it wrote down.
send e1 -> ct1
@step conntrack undoes the rewrite: the source 198.51.100.7 becomes 192.0.2.10 again.
highlight ct1
@step Out of node 1's kernel into the frontend's veth.
send "from 192.0.2.10" ct1 -> v1
@step Into the frontend, which sees the service answer. Other networks under a cluster do the middle hop another way: a routed CNI has a route "node 2's pod range → node 2"; an overlay wraps the packet from node IP to node IP. The kube-proxy part stays the same.
send v1 -> fe
```

:::llm
Animation, 22 steps, flat. Node 1 (frontend pod 198.51.100.4, kube-proxy; kernel with the frontend's veth, the iptables rules, conntrack; network card), the VPC, node 2 (web-2 198.51.100.7, kube-proxy; kernel with web-2's veth and routes; network card). kube-proxy only writes the rules.

1. to 4. The nodes and the VPC; kube-proxy writes rules on every node; the frontend calls the service at 192.0.2.10, a virtual IP.
5. to 8. Veth, node 1's kernel: a rule rewrites the destination to 198.51.100.7, conntrack notes it, node 1 routes it out of its card.
9. to 13. The VPC (AWS VPC CNI: the IP belongs to node 2's card) delivers it; node 2's kernel routes it through the veth into web-2. No second rewrite.
14. to 22. The reply comes back the same hops; node 1's conntrack restores the source 192.0.2.10. A routed CNI or an overlay would do the middle hop instead.
:::

:::accordion
#### Source: `fixtures/format/66-animation-a-packet-through-kube-proxy.dh.md`
````text
---
title: "Animation: a packet through kube-proxy"
description: A fixture made from the Format page section of the same name.
---

## Animation: a packet through kube-proxy

Two nodes and the VPC under them, drawn flat so every word reads: each node shows its pods, its kernel and its network card, and every step is drawn at one fixed place. `layout=row` puts the nodes side by side with the VPC between them; on a phone they stack, node 1 above the VPC above node 2. The call takes the real path: the frontend's veth, node 1's kernel, where a rule kube-proxy wrote rewrites the service's virtual IP to one pod's IP (kube-proxy itself never carries the packet), node 1's network card, the VPC, node 2's network card and kernel, web-2's veth. The reply comes back the same way, and node 1's conntrack undoes the rewrite.

```animation layout=row
family pod "pods"
family kp "kube-proxy"
family kern "node kernels"
family net "network cards and the VPC"
group n1 "node 1" layout=column note="node IP 198.51.100.21"
group n1p in n1 layout=row
box fe "frontend" in n1p is=pod note="a pod; pod IP 198.51.100.4"
box kp1 "kube-proxy" in n1p is=kp note="runs on every node; watches the API for services and their pods, and writes the rules. It never carries a packet"
group n1k "kernel" in n1 layout=row is=kern
box v1 "veth" in n1k is=kern size=s note="the frontend's veth: a cable with one end in the pod and one in the node"
box r1 "rules" in n1k is=kern size=s note="the iptables rules kube-proxy wrote: every packet to 192.0.2.10 meets them"
box ct1 "conntrack" in n1k is=kern size=s note="remembers each rewrite, to undo it on the reply"
box e1 "network card" in n1 is=net note="eth0, node 1's network card"
box vr "VPC" is=net note="the network under the cluster. Its route table: 198.51.100.0/24 is local. With AWS's VPC CNI, web-2's IP 198.51.100.7 is a second address of node 2's network card"
group n2 "node 2" layout=column note="node IP 198.51.100.22"
group n2p in n2 layout=row
box w2 "web-2" in n2p is=pod note="a pod of the service web; pod IP 198.51.100.7"
box kp2 "kube-proxy" in n2p is=kp note="the same on every node"
group n2k "kernel" in n2 layout=row is=kern
box v2 "veth" in n2k is=kern size=s note="web-2's veth"
box rt2 "routes" in n2k is=kern size=s note="198.51.100.7 is a pod on this node: through web-2's veth"
box e2 "network card" in n2 is=net note="eth0, node 2's network card"
e1 -> vr
vr -> e2
@step Two nodes and the VPC, the network under them.
@step On each node: its pods at the top, its kernel, and its network card at the bottom, where packets leave and enter the node.
@step kube-proxy runs on every node. It watches the API for the service web and writes rules into the kernel's iptables. It never carries a packet.
highlight kp1
@step The frontend calls the service web at 192.0.2.10. No pod and no machine has that address: it lives only in rules.
highlight fe
@step The packet leaves the frontend through its veth, into node 1's kernel.
send fe -> v1
@step In node 1's kernel it meets the rules kube-proxy wrote. kube-proxy itself never touches the packet.
send "to 192.0.2.10" v1 -> r1
@step A rule picks one of the service's pods at random, web-2, and rewrites the destination to its IP. conntrack writes the rewrite down.
say r1 above: → 198.51.100.7
highlight r1
@step 198.51.100.7 is not on node 1, so node 1's kernel routes the packet out of its own network card.
send r1 -> e1
@step The packet enters the VPC. Its route table knows 198.51.100.7: on AWS's VPC CNI, it is an address of node 2's network card.
send "to 198.51.100.7" e1 -> vr
say vr above: 198.51.100.7 → node 2
@step The VPC delivers it to node 2's network card. No tunnel and no rewrite on the way.
send vr -> e2
@step Node 2's kernel looks up its routes: 198.51.100.7 is a pod on this node.
send e2 -> rt2
@step The route sends it into web-2's veth.
send rt2 -> v2
@step Through the veth into web-2. No second rewrite: the address is already a pod's.
send v2 -> w2
@step web-2 answers from 198.51.100.7, back into its veth.
send w2 -> v2
@step Into node 2's kernel, which routes the reply toward 198.51.100.4.
send "200 OK" v2 -> rt2
@step Out of node 2's network card.
send rt2 -> e2
@step Into the VPC: 198.51.100.4 is an address of node 1's network card.
send "200 OK" e2 -> vr
@step The VPC delivers it to node 1's network card.
send "200 OK" vr -> e1
@step Into node 1's kernel, where conntrack knows this reply: it belongs to the rewrite it wrote down.
send e1 -> ct1
@step conntrack undoes the rewrite: the source 198.51.100.7 becomes 192.0.2.10 again.
highlight ct1
@step Out of node 1's kernel into the frontend's veth.
send "from 192.0.2.10" ct1 -> v1
@step Into the frontend, which sees the service answer. Other networks under a cluster do the middle hop another way: a routed CNI has a route "node 2's pod range → node 2"; an overlay wraps the packet from node IP to node IP. The kube-proxy part stays the same.
send v1 -> fe
```

:::llm
Animation, 22 steps, flat. Node 1 (frontend pod 198.51.100.4, kube-proxy; kernel with the frontend's veth, the iptables rules, conntrack; network card), the VPC, node 2 (web-2 198.51.100.7, kube-proxy; kernel with web-2's veth and routes; network card). kube-proxy only writes the rules.

1. to 4. The nodes and the VPC; kube-proxy writes rules on every node; the frontend calls the service at 192.0.2.10, a virtual IP.
5. to 8. Veth, node 1's kernel: a rule rewrites the destination to 198.51.100.7, conntrack notes it, node 1 routes it out of its card.
9. to 13. The VPC (AWS VPC CNI: the IP belongs to node 2's card) delivers it; node 2's kernel routes it through the veth into web-2. No second rewrite.
14. to 22. The reply comes back the same hops; node 1's conntrack restores the source 192.0.2.10. A routed CNI or an overlay would do the middle hop instead.
:::
````
:::


## 3D: a request through the network layers

Two machines with the same five layers. When top-level things sit on two or more layers, the 2D stage draws one band per layer and lines up each band's things in columns, so the two stacks stand side by side.

```animation 3d
layer app "application"
layer tls "TLS"
layer tcp "TCP"
layer ip "IP"
layer link "link"
family cl "the browser's machine"
family sv "the server's machine"
box a1 "browser" layer=app is=cl
box b1 "web server" layer=app is=sv
box a2 "encrypt" layer=tls is=cl
box b2 "decrypt" layer=tls is=sv
box a3 "segments" layer=tcp is=cl
box b3 "segments" layer=tcp is=sv
box a4 "packets" layer=ip is=cl
box b4 "packets" layer=ip is=sv
box a5 "Wi-Fi" layer=link is=cl note="the laptop's network card"
box b5 "Ethernet" layer=link is=sv note="the server's network card"
a1 -> a2 -> a3 -> a4 -> a5
b5 -> b4 -> b3 -> b2 -> b1
a5 -> b5 "the wire"
@step A browser on one machine asks a web server on another for a page. Each machine has the same five layers.
split layers
@step Going down: TLS encrypts the request.
send "GET /" a1 -> a2
@step TCP cuts it into numbered segments.
send "encrypted" a2 -> a3
camera a3 close turn=left
@step IP addresses each one: packets.
send "segments" a3 -> a4
camera a4 close turn=left
@step The link layer makes them signals.
send "packets" a4 -> a5
camera a5 close turn=left tilt=low
@step The signals cross the wire to the other machine.
send "bits" a5 -> b5
camera a5 b5 turn=front tilt=low
@step Going up, each layer undoes its twin's work: to IP.
send "bits" b5 -> b4
camera all
@step IP hands the segments to TCP.
send "packets" b4 -> b3
@step TCP puts them in order, for TLS.
send "segments" b3 -> b2
@step TLS decrypts the request, and the web server reads it.
send "GET /" b2 -> b1
@step Look at one layer: TCP on both machines talks only to TCP. The layers above and below are its tools.
focus tcp
highlight a3 b3
@step The web server's reply goes back to the browser the same way, one layer per hop.
focus all
stack layers
highlight b1 a1 tone=good
say b1: 200 OK
```

:::accordion
#### Source: `fixtures/format/67-3d-a-request-through-the-network-layers.dh.md`
````text
---
title: "3D: a request through the network layers"
description: A fixture made from the Format page section of the same name.
---

## 3D: a request through the network layers

Two machines with the same five layers. When top-level things sit on two or more layers, the 2D stage draws one band per layer and lines up each band's things in columns, so the two stacks stand side by side.

```animation 3d
layer app "application"
layer tls "TLS"
layer tcp "TCP"
layer ip "IP"
layer link "link"
family cl "the browser's machine"
family sv "the server's machine"
box a1 "browser" layer=app is=cl
box b1 "web server" layer=app is=sv
box a2 "encrypt" layer=tls is=cl
box b2 "decrypt" layer=tls is=sv
box a3 "segments" layer=tcp is=cl
box b3 "segments" layer=tcp is=sv
box a4 "packets" layer=ip is=cl
box b4 "packets" layer=ip is=sv
box a5 "Wi-Fi" layer=link is=cl note="the laptop's network card"
box b5 "Ethernet" layer=link is=sv note="the server's network card"
a1 -> a2 -> a3 -> a4 -> a5
b5 -> b4 -> b3 -> b2 -> b1
a5 -> b5 "the wire"
@step A browser on one machine asks a web server on another for a page. Each machine has the same five layers.
split layers
@step Going down: TLS encrypts the request.
send "GET /" a1 -> a2
@step TCP cuts it into numbered segments.
send "encrypted" a2 -> a3
camera a3 close turn=left
@step IP addresses each one: packets.
send "segments" a3 -> a4
camera a4 close turn=left
@step The link layer makes them signals.
send "packets" a4 -> a5
camera a5 close turn=left tilt=low
@step The signals cross the wire to the other machine.
send "bits" a5 -> b5
camera a5 b5 turn=front tilt=low
@step Going up, each layer undoes its twin's work: to IP.
send "bits" b5 -> b4
camera all
@step IP hands the segments to TCP.
send "packets" b4 -> b3
@step TCP puts them in order, for TLS.
send "segments" b3 -> b2
@step TLS decrypts the request, and the web server reads it.
send "GET /" b2 -> b1
@step Look at one layer: TCP on both machines talks only to TCP. The layers above and below are its tools.
focus tcp
highlight a3 b3
@step The web server's reply goes back to the browser the same way, one layer per hop.
focus all
stack layers
highlight b1 a1 tone=good
say b1: 200 OK
```
````
:::


## 3D: a message through a router, in segments

A thing can have an inside. `group r "router" closed=yes` draws the router's inside faint and without words; `zoom into r` flies the camera in and opens it, and `zoom out` closes it again. Inside, a queue holds tokens: `move ... into q` puts them at its back, and `pop q to p2` takes the front one out. `drop msg.4 at q` sends a token there and loses it, the way a full router drops a packet. Here, TCP cuts a message into segments, a router forwards them, one is lost and sent again, and host B puts the message back together.

```animation 3d
layer net "one network"
family a "host A"
family b "host B"
family rr "router"
group ha "host A" layout=column is=a
group r "router" closed=yes layout=free is=rr
queue q "input queue" in r pos=0,0 is=rr
table rt "routing table" in r pos=0,2.2 is=rr: to, port
row r1 in rt: host B, 2
row r2 in rt: host C, 1
group p2 "port 2" in r layout=column pos=4.4,2.2 is=rr
group hb "host B" layout=column is=b
ha -> q
p2 -> hb
token msg "message" in ha is=a
@step Host A has one message for host B: too big for one packet.
highlight msg
@step TCP cuts it into four numbered segments.
split msg into 4 "seg"
@step Zoom into the router: an input queue, a routing table, and port 2.
zoom into r
@step The segments arrive. The queue holds three; segment 4 finds it full.
move msg.1 msg.2 msg.3 into q
drop msg.4 at q
@step The routing table says host B is behind port 2.
highlight r1
@step The oldest segment leaves the queue for port 2.
pop q to p2
@step The next one follows; segment 3 waits its turn.
pop q to p2
@step Zoom out: segments 1 and 2 cross the wire to host B.
zoom out
move msg.1 msg.2 into hb
@step Segment 3 follows them.
pop q to hb
@step Host B has 1, 2 and 3, but not 4. Host A sends segment 4 again.
add token msg.4 "seg 4" in ha
@step This time it gets through the router.
move msg.4 to r
@step It reaches host B.
move msg.4 into hb
@step Host B puts the four segments back in order: the message.
merge msg
```

:::accordion
#### Source: `fixtures/format/68-3d-a-message-through-a-router-in-segments.dh.md`
````text
---
title: "3D: a message through a router, in segments"
description: A fixture made from the Format page section of the same name.
---

## 3D: a message through a router, in segments

A thing can have an inside. `group r "router" closed=yes` draws the router's inside faint and without words; `zoom into r` flies the camera in and opens it, and `zoom out` closes it again. Inside, a queue holds tokens: `move ... into q` puts them at its back, and `pop q to p2` takes the front one out. `drop msg.4 at q` sends a token there and loses it, the way a full router drops a packet. Here, TCP cuts a message into segments, a router forwards them, one is lost and sent again, and host B puts the message back together.

```animation 3d
layer net "one network"
family a "host A"
family b "host B"
family rr "router"
group ha "host A" layout=column is=a
group r "router" closed=yes layout=free is=rr
queue q "input queue" in r pos=0,0 is=rr
table rt "routing table" in r pos=0,2.2 is=rr: to, port
row r1 in rt: host B, 2
row r2 in rt: host C, 1
group p2 "port 2" in r layout=column pos=4.4,2.2 is=rr
group hb "host B" layout=column is=b
ha -> q
p2 -> hb
token msg "message" in ha is=a
@step Host A has one message for host B: too big for one packet.
highlight msg
@step TCP cuts it into four numbered segments.
split msg into 4 "seg"
@step Zoom into the router: an input queue, a routing table, and port 2.
zoom into r
@step The segments arrive. The queue holds three; segment 4 finds it full.
move msg.1 msg.2 msg.3 into q
drop msg.4 at q
@step The routing table says host B is behind port 2.
highlight r1
@step The oldest segment leaves the queue for port 2.
pop q to p2
@step The next one follows; segment 3 waits its turn.
pop q to p2
@step Zoom out: segments 1 and 2 cross the wire to host B.
zoom out
move msg.1 msg.2 into hb
@step Segment 3 follows them.
pop q to hb
@step Host B has 1, 2 and 3, but not 4. Host A sends segment 4 again.
add token msg.4 "seg 4" in ha
@step This time it gets through the router.
move msg.4 to r
@step It reaches host B.
move msg.4 into hb
@step Host B puts the four segments back in order: the message.
merge msg
```
````
:::


## 3D: the seven network layers, and a scene inside the scene

A scene can hold a scene of its own. `scene tcp "Transport, up close"` in the setup, its own lines, then `end`, declares it, with its own things and layout. `enter tcp from a4` flies the camera into `a4` and shows that scene instead of the overview; the steps after it change that scene; `leave` flies back out to the overview, just as it was left. The caption says which scene you are in, the slider marks its steps, and "All steps" lists them inside the step that enters. Here, a request goes down the seven layers of the OSI model on one machine and up them on the other; at layer 4 the story zooms into how TCP labels, cuts and rebuilds the message. It reads the same in 2D: press **2D**.

```animation 3d size=s
layer l7 "7 application"
layer l6 "6 presentation"
layer l5 "5 session"
layer l4 "4 transport"
layer l3 "3 network"
layer l2 "2 data link"
layer l1 "1 physical"
family cl "the browser's machine"
family sv "the server's machine"
box a7 "browser" layer=l7 is=cl
box b7 "web server" layer=l7 is=sv
box a6 "format, encrypt" layer=l6 is=cl
box b6 "decrypt" layer=l6 is=sv
box a5 "session" layer=l5 is=cl
box b5 "session" layer=l5 is=sv
box a4 "TCP" layer=l4 is=cl
box b4 "TCP" layer=l4 is=sv
box a3 "IP" layer=l3 is=cl
box b3 "IP" layer=l3 is=sv
box a2 "Ethernet" layer=l2 is=cl
box b2 "Ethernet" layer=l2 is=sv
box a1 "signals" layer=l1 is=cl
box b1 "signals" layer=l1 is=sv
a7 -> a6 -> a5 -> a4 -> a3 -> a2 -> a1
b1 -> b2 -> b3 -> b4 -> b5 -> b6 -> b7
a1 -> b1 "the wire"
token msg "GET /" at a7 is=cl
scene tcp "Transport, up close" layout=column
  group snd "sender's TCP" layout=column is=cl
  group out "to send" in snd layout=row
  token m "3,000 bytes" in out is=cl
  table hdr "TCP header" in snd: field, value
  row h1 in hdr: from port, 51514
  row h2 in hdr: to port, 443
  row h3 in hdr: sequence, its first byte
  cloud net "the network"
  group rcv "receiver's TCP" layout=column is=sv
  group buf "receive buffer" in rcv layout=row
  snd -> net -> rcv
end
@step A browser asks a web server for a page. The request starts at layer 7, application: HTTP.
split layers
highlight a7
@step Layer 6, presentation: the request is put in an agreed format and encrypted.
move msg to a6
set msg label=encrypted
@step Layer 5, session: the conversation between the two programs stays open for the reply.
move msg to a5
@step Layer 4, transport: TCP cuts the message into three numbered segments.
move msg to a4
then
split msg into 3 "seg"
@step Up close: how TCP labels the segments, sends them, and puts them back together.
enter tcp from a4
@step Each segment gets a TCP header: the ports say which program it is from and for; the sequence number says where its bytes go.
highlight hdr
@step TCP cuts the 3,000 bytes into three segments of 1,000. Each is numbered by its first byte: 1, 1001, 2001.
split m into s1 "seq 1" s2 "seq 1001" s3 "seq 2001"
@step All three go out on the network. Each may take its own path.
move s1 s2 s3 to net
@step Segments 1 and 3 arrive first. TCP keeps 3 aside: bytes from 1001 are missing.
move s1 s3 into buf
@step Segment 2 arrives late. Its sequence number says where it goes: between 1 and 3.
move s2 into buf after s1
@step In order again, the segments are joined back into the 3,000 bytes. TCP sends back ACK 3001: "next, I expect byte 3001".
merge s1 s2 s3 into m2 "3,000 bytes"
send arrow "ACK 3001" rcv -> net
@step Back at the overview, where we left it. Now follow the segments down, across and up.
leave
@step Layer 3, network: each segment gets an IP header with both machines' addresses. It is now a packet.
move msg.1 msg.2 msg.3 to a3
@step Layer 2, data link: each packet goes in a frame for the next hop on the local network.
move msg.1 msg.2 msg.3 to a2
@step Layer 1, physical: the frames become signals.
move msg.1 msg.2 msg.3 to a1
@step The signals cross the wire to the server's machine.
move msg.1 msg.2 msg.3 to b1
@step Going up, layers 1 to 3 each read and remove their twin's header. TCP joins the segments, as we saw up close.
move msg.1 msg.2 msg.3 to b4
then
merge msg
@step Up through session and presentation, where it is decrypted, the web server reads the request.
move msg to b7
set msg label="GET /"
highlight b7 tone=good
```

:::llm
Animation, 18 steps, with 1 scene inside it (tcp "Transport, up close"). Two machines, each with the seven OSI layers; a request ("GET /") starts in the browser at layer 7.

1. to 4. Down layers 7, 6 (formatted, encrypted) and 5 (session) to layer 4, where TCP splits it into seg 1 to 3.
5. Enters scene tcp from a4: the sender's TCP (the 3,000 bytes, a header with ports and a sequence number), a network, the receiver's TCP.
   6. to 11. Cut into seq 1, seq 1001, seq 2001; all cross the network; 1 and 3 arrive first; 2 arrives late and goes between them; joined again; the receiver answers ACK 3001.
12. Leaves scene tcp: back to the overview, as it was, at a4.
13. to 18. Down layers 3, 2 and 1, across the wire, up to layer 4 where TCP joins the segments, and up to the web server, which reads GET /.
:::

:::accordion
#### Source: `fixtures/format/69-3d-the-seven-network-layers-and-a-scene-inside-the-scene.dh.md`
````text
---
title: "3D: the seven network layers, and a scene inside the scene"
description: A fixture made from the Format page section of the same name.
---

## 3D: the seven network layers, and a scene inside the scene

A scene can hold a scene of its own. `scene tcp "Transport, up close"` in the setup, its own lines, then `end`, declares it, with its own things and layout. `enter tcp from a4` flies the camera into `a4` and shows that scene instead of the overview; the steps after it change that scene; `leave` flies back out to the overview, just as it was left. The caption says which scene you are in, the slider marks its steps, and "All steps" lists them inside the step that enters. Here, a request goes down the seven layers of the OSI model on one machine and up them on the other; at layer 4 the story zooms into how TCP labels, cuts and rebuilds the message. It reads the same in 2D: press **2D**.

```animation 3d size=s
layer l7 "7 application"
layer l6 "6 presentation"
layer l5 "5 session"
layer l4 "4 transport"
layer l3 "3 network"
layer l2 "2 data link"
layer l1 "1 physical"
family cl "the browser's machine"
family sv "the server's machine"
box a7 "browser" layer=l7 is=cl
box b7 "web server" layer=l7 is=sv
box a6 "format, encrypt" layer=l6 is=cl
box b6 "decrypt" layer=l6 is=sv
box a5 "session" layer=l5 is=cl
box b5 "session" layer=l5 is=sv
box a4 "TCP" layer=l4 is=cl
box b4 "TCP" layer=l4 is=sv
box a3 "IP" layer=l3 is=cl
box b3 "IP" layer=l3 is=sv
box a2 "Ethernet" layer=l2 is=cl
box b2 "Ethernet" layer=l2 is=sv
box a1 "signals" layer=l1 is=cl
box b1 "signals" layer=l1 is=sv
a7 -> a6 -> a5 -> a4 -> a3 -> a2 -> a1
b1 -> b2 -> b3 -> b4 -> b5 -> b6 -> b7
a1 -> b1 "the wire"
token msg "GET /" at a7 is=cl
scene tcp "Transport, up close" layout=column
  group snd "sender's TCP" layout=column is=cl
  group out "to send" in snd layout=row
  token m "3,000 bytes" in out is=cl
  table hdr "TCP header" in snd: field, value
  row h1 in hdr: from port, 51514
  row h2 in hdr: to port, 443
  row h3 in hdr: sequence, its first byte
  cloud net "the network"
  group rcv "receiver's TCP" layout=column is=sv
  group buf "receive buffer" in rcv layout=row
  snd -> net -> rcv
end
@step A browser asks a web server for a page. The request starts at layer 7, application: HTTP.
split layers
highlight a7
@step Layer 6, presentation: the request is put in an agreed format and encrypted.
move msg to a6
set msg label=encrypted
@step Layer 5, session: the conversation between the two programs stays open for the reply.
move msg to a5
@step Layer 4, transport: TCP cuts the message into three numbered segments.
move msg to a4
then
split msg into 3 "seg"
@step Up close: how TCP labels the segments, sends them, and puts them back together.
enter tcp from a4
@step Each segment gets a TCP header: the ports say which program it is from and for; the sequence number says where its bytes go.
highlight hdr
@step TCP cuts the 3,000 bytes into three segments of 1,000. Each is numbered by its first byte: 1, 1001, 2001.
split m into s1 "seq 1" s2 "seq 1001" s3 "seq 2001"
@step All three go out on the network. Each may take its own path.
move s1 s2 s3 to net
@step Segments 1 and 3 arrive first. TCP keeps 3 aside: bytes from 1001 are missing.
move s1 s3 into buf
@step Segment 2 arrives late. Its sequence number says where it goes: between 1 and 3.
move s2 into buf after s1
@step In order again, the segments are joined back into the 3,000 bytes. TCP sends back ACK 3001: "next, I expect byte 3001".
merge s1 s2 s3 into m2 "3,000 bytes"
send arrow "ACK 3001" rcv -> net
@step Back at the overview, where we left it. Now follow the segments down, across and up.
leave
@step Layer 3, network: each segment gets an IP header with both machines' addresses. It is now a packet.
move msg.1 msg.2 msg.3 to a3
@step Layer 2, data link: each packet goes in a frame for the next hop on the local network.
move msg.1 msg.2 msg.3 to a2
@step Layer 1, physical: the frames become signals.
move msg.1 msg.2 msg.3 to a1
@step The signals cross the wire to the server's machine.
move msg.1 msg.2 msg.3 to b1
@step Going up, layers 1 to 3 each read and remove their twin's header. TCP joins the segments, as we saw up close.
move msg.1 msg.2 msg.3 to b4
then
merge msg
@step Up through session and presentation, where it is decrypted, the web server reads the request.
move msg to b7
set msg label="GET /"
highlight b7 tone=good
```

:::llm
Animation, 18 steps, with 1 scene inside it (tcp "Transport, up close"). Two machines, each with the seven OSI layers; a request ("GET /") starts in the browser at layer 7.

1. to 4. Down layers 7, 6 (formatted, encrypted) and 5 (session) to layer 4, where TCP splits it into seg 1 to 3.
5. Enters scene tcp from a4: the sender's TCP (the 3,000 bytes, a header with ports and a sequence number), a network, the receiver's TCP.
   6. to 11. Cut into seq 1, seq 1001, seq 2001; all cross the network; 1 and 3 arrive first; 2 arrives late and goes between them; joined again; the receiver answers ACK 3001.
12. Leaves scene tcp: back to the overview, as it was, at a4.
13. to 18. Down layers 3, 2 and 1, across the wire, up to layer 4 where TCP joins the segments, and up to the web server, which reads GET /.
:::
````
:::


## 3D: a database in three regions

Regions as layers: a write lands in one region, and its copies arrive in the others at different times.

```animation 3d
layer us "us-east"
layer eu "eu-west"
layer ap "ap-south"
family user "users"
family db "database"
family copy "copying"
person u1 "user in Virginia" layer=us is=user
cylinder db1 "primary" layer=us is=db note="takes every write"
person u2 "user in Paris" layer=eu is=user
cylinder db2 "replica" layer=eu is=db note="a read-only copy"
person u3 "user in Mumbai" layer=ap is=user
cylinder db3 "replica" layer=ap is=db note="a read-only copy"
db1 --> db2 "copies" is=copy
db1 --> db3 "copies" is=copy
@step Three regions, each with a copy of the database. Only the primary, in us-east, takes writes.
split layers
@step A user in Virginia adds an item to their cart. The primary writes it as change 41.
send "write: cart +1" u1 -> db1
say db1: change 41
@step The primary sends change 41 down to the other regions.
send arrow "change 41" db1 -> db2 is=copy
send arrow "change 41" db1 -> db3 is=copy
@step Paris gets it first.
highlight db2 tone=good
camera db2 db3 turn=right tilt=low
@step Mumbai is further away and still has change 40.
highlight db3 tone=warn
say db3: still at 40
@step Look at ap-south alone: a read here now gets the cart without the new item. That gap is replication lag.
focus ap
send "read cart" u3 -> db3
@step A moment later change 41 arrives, and every region reads the same cart.
focus all
camera all
highlight db3 tone=good
send "read cart" u3 -> db3
```

:::accordion
#### Source: `fixtures/format/70-3d-a-database-in-three-regions.dh.md`
````text
---
title: "3D: a database in three regions"
description: A fixture made from the Format page section of the same name.
---

## 3D: a database in three regions

Regions as layers: a write lands in one region, and its copies arrive in the others at different times.

```animation 3d
layer us "us-east"
layer eu "eu-west"
layer ap "ap-south"
family user "users"
family db "database"
family copy "copying"
person u1 "user in Virginia" layer=us is=user
cylinder db1 "primary" layer=us is=db note="takes every write"
person u2 "user in Paris" layer=eu is=user
cylinder db2 "replica" layer=eu is=db note="a read-only copy"
person u3 "user in Mumbai" layer=ap is=user
cylinder db3 "replica" layer=ap is=db note="a read-only copy"
db1 --> db2 "copies" is=copy
db1 --> db3 "copies" is=copy
@step Three regions, each with a copy of the database. Only the primary, in us-east, takes writes.
split layers
@step A user in Virginia adds an item to their cart. The primary writes it as change 41.
send "write: cart +1" u1 -> db1
say db1: change 41
@step The primary sends change 41 down to the other regions.
send arrow "change 41" db1 -> db2 is=copy
send arrow "change 41" db1 -> db3 is=copy
@step Paris gets it first.
highlight db2 tone=good
camera db2 db3 turn=right tilt=low
@step Mumbai is further away and still has change 40.
highlight db3 tone=warn
say db3: still at 40
@step Look at ap-south alone: a read here now gets the cart without the new item. That gap is replication lag.
focus ap
send "read cart" u3 -> db3
@step A moment later change 41 arrives, and every region reads the same cart.
focus all
camera all
highlight db3 tone=good
send "read cart" u3 -> db3
```
````
:::


## 3D: not only code, a building's floors

Floors as layers, and people moving between them: `move` into a container on another layer carries a thing (and what it holds) up or down.

```animation 3d
layer f3 "3rd floor: offices"
layer f2 "2nd floor: cafe"
layer f1 "1st floor: gym"
layer gr "lobby"
group fl3 layer=f3
group fl2 layer=f2
group fl1 layer=f1
group lobby layer=gr
group lift "lift" in fl3 tone=acc
box desk "Ana's desk" in fl3
box cafe "cafe" in fl2
box gym "gym" in fl1
person ana "Ana" in lobby
person ben "Ben" in lobby
@step A building with four floors. Ana and Ben wait in the lobby; the lift is up on the 3rd floor.
split layers
@step The lift comes down to the lobby.
move lift to lobby
@step Ana and Ben step in.
move ana to lift
move ben to lift
@step The lift goes up to the 2nd floor, and Ben gets out for coffee.
move lift to fl2
then
move ben to fl2
@step The lift goes on to the 3rd floor, and Ana walks to her desk.
move lift to fl3
then
move ana to fl3 after desk
focus f3
```

:::accordion
#### Source: `fixtures/format/71-3d-not-only-code-a-building-s-floors.dh.md`
````text
---
title: "3D: not only code, a building's floors"
description: A fixture made from the Format page section of the same name.
---

## 3D: not only code, a building's floors

Floors as layers, and people moving between them: `move` into a container on another layer carries a thing (and what it holds) up or down.

```animation 3d
layer f3 "3rd floor: offices"
layer f2 "2nd floor: cafe"
layer f1 "1st floor: gym"
layer gr "lobby"
group fl3 layer=f3
group fl2 layer=f2
group fl1 layer=f1
group lobby layer=gr
group lift "lift" in fl3 tone=acc
box desk "Ana's desk" in fl3
box cafe "cafe" in fl2
box gym "gym" in fl1
person ana "Ana" in lobby
person ben "Ben" in lobby
@step A building with four floors. Ana and Ben wait in the lobby; the lift is up on the 3rd floor.
split layers
@step The lift comes down to the lobby.
move lift to lobby
@step Ana and Ben step in.
move ana to lift
move ben to lift
@step The lift goes up to the 2nd floor, and Ben gets out for coffee.
move lift to fl2
then
move ben to fl2
@step The lift goes on to the 3rd floor, and Ana walks to her desk.
move lift to fl3
then
move ana to fl3 after desk
focus f3
```
````
:::


## 3D: a 2D scene, unchanged

The pass-4 scene of pods, nodes and a service, with the same source. Press **3D** on its stage: with no layers declared, each nesting level is a layer, so the cluster, the nodes and the pods stand at three heights.

```animation dir=down
group cluster "cluster" layout=row
group n1 "node 1" in cluster
group n2 "node 2" in cluster
group n3 "node 3" in cluster
pill w1 "web-1" in n1
pill c1 "cache-1" in n1
pill w2 "web-2" in n2
pill w3 "web-3" in n3
pill svc "service: web"
svc -> w1
svc -> w2
svc -> w3
note svc: one stable name and address in front of the web pods
@step Pods run on nodes; nodes make up the cluster. The service is one name in front of the three web pods.
camera all
@step Calls to the service are spread over its pods: rules on every node pick one.
send "GET /" svc -> w1
send "GET /cart" svc -> w2
@step Node 2 dies, and web-2 with it.
set n2 down=yes
set w2 down=yes
camera cluster
@step The scheduler starts a new web-2 on node 3, which has room.
remove w2
add pill w2b "web-2" in n3 tone=good
svc -> w2b
@step The rules now pick among the running pods only; nobody sees a gap.
send "GET /cart" svc -> w2b
camera all
```

:::accordion
#### Source: `fixtures/format/72-3d-a-2d-scene-unchanged.dh.md`
````text
---
title: "3D: a 2D scene, unchanged"
description: A fixture made from the Format page section of the same name.
---

## 3D: a 2D scene, unchanged

The pass-4 scene of pods, nodes and a service, with the same source. Press **3D** on its stage: with no layers declared, each nesting level is a layer, so the cluster, the nodes and the pods stand at three heights.

```animation dir=down
group cluster "cluster" layout=row
group n1 "node 1" in cluster
group n2 "node 2" in cluster
group n3 "node 3" in cluster
pill w1 "web-1" in n1
pill c1 "cache-1" in n1
pill w2 "web-2" in n2
pill w3 "web-3" in n3
pill svc "service: web"
svc -> w1
svc -> w2
svc -> w3
note svc: one stable name and address in front of the web pods
@step Pods run on nodes; nodes make up the cluster. The service is one name in front of the three web pods.
camera all
@step Calls to the service are spread over its pods: rules on every node pick one.
send "GET /" svc -> w1
send "GET /cart" svc -> w2
@step Node 2 dies, and web-2 with it.
set n2 down=yes
set w2 down=yes
camera cluster
@step The scheduler starts a new web-2 on node 3, which has room.
remove w2
add pill w2b "web-2" in n3 tone=good
svc -> w2b
@step The rules now pick among the running pods only; nobody sees a gap.
send "GET /cart" svc -> w2b
camera all
```
````
:::


## 3D by a new author: a memory read

Written from the spec alone by a helper that had not seen the engine; doccheck passed it on the first try.

```animation 3d dir=down
layer reg "registers" note="Inside the CPU. Tiny and the fastest place there is."
layer l1 "L1 cache" note="Small and very fast. Each core has its own."
layer l2 "L2 cache" note="Bigger than L1 and a bit slower."
layer ram "RAM" note="Main memory. Large, but far slower than the caches."
layer disk "disk" note="Storage. Huge, and by far the slowest."
box cpu "program" layer=reg
box c1 "L1 cache" layer=l1
box c2 "L2 cache" layer=l2
box mem "RAM" layer=ram note="Holds the data the program is using right now."
cylinder dsk "disk" layer=disk
pill vx "x = 42" layer=ram
cpu -> c1 -> c2 -> mem -> dsk
@step The program wants the value x. It asks the fastest place first, the L1 cache, and x is not there (a miss).
split layers
send "read x" cpu -> c1
say c1: miss, no x here
@step The L1 cache passes the question down to the L2 cache. Another miss.
send "read x" c1 -> c2
say c2: miss, no x here
highlight c2 tone=warn
@step The L2 cache asks RAM, and RAM has x (a hit). The disk is not needed.
send "read x" c2 -> mem
say mem: found x
highlight mem vx tone=good
set dsk dim=yes
@step Zoom in on RAM. This is the slow part of the trip, which is why caches exist.
focus ram
note vx: the value the program asked for
@step The camera pulls back. The value starts its way up, and the L2 cache keeps a copy.
focus all
send "x = 42" mem -> c2
add pill x2 "x = 42" layer=l2
@step The L1 cache keeps a copy too.
send "x = 42" c2 -> c1
add pill x1 "x = 42" layer=l1
@step The value reaches the program and is held in a register.
send "x = 42" c1 -> cpu
add pill xr "x = 42" layer=reg
@step Layers back together. The next read of x is answered at once, with no trip down.
stack layers
highlight xr tone=good
```

:::accordion
#### Source: `fixtures/format/73-3d-by-a-new-author-a-memory-read.dh.md`
````text
---
title: "3D by a new author: a memory read"
description: A fixture made from the Format page section of the same name.
---

## 3D by a new author: a memory read

Written from the spec alone by a helper that had not seen the engine; doccheck passed it on the first try.

```animation 3d dir=down
layer reg "registers" note="Inside the CPU. Tiny and the fastest place there is."
layer l1 "L1 cache" note="Small and very fast. Each core has its own."
layer l2 "L2 cache" note="Bigger than L1 and a bit slower."
layer ram "RAM" note="Main memory. Large, but far slower than the caches."
layer disk "disk" note="Storage. Huge, and by far the slowest."
box cpu "program" layer=reg
box c1 "L1 cache" layer=l1
box c2 "L2 cache" layer=l2
box mem "RAM" layer=ram note="Holds the data the program is using right now."
cylinder dsk "disk" layer=disk
pill vx "x = 42" layer=ram
cpu -> c1 -> c2 -> mem -> dsk
@step The program wants the value x. It asks the fastest place first, the L1 cache, and x is not there (a miss).
split layers
send "read x" cpu -> c1
say c1: miss, no x here
@step The L1 cache passes the question down to the L2 cache. Another miss.
send "read x" c1 -> c2
say c2: miss, no x here
highlight c2 tone=warn
@step The L2 cache asks RAM, and RAM has x (a hit). The disk is not needed.
send "read x" c2 -> mem
say mem: found x
highlight mem vx tone=good
set dsk dim=yes
@step Zoom in on RAM. This is the slow part of the trip, which is why caches exist.
focus ram
note vx: the value the program asked for
@step The camera pulls back. The value starts its way up, and the L2 cache keeps a copy.
focus all
send "x = 42" mem -> c2
add pill x2 "x = 42" layer=l2
@step The L1 cache keeps a copy too.
send "x = 42" c2 -> c1
add pill x1 "x = 42" layer=l1
@step The value reaches the program and is held in a register.
send "x = 42" c1 -> cpu
add pill xr "x = 42" layer=reg
@step Layers back together. The next read of x is answered at once, with no trip down.
stack layers
highlight xr tone=good
```
````
:::


## Animation: code, bold and italic in captions

Captions, `say` and `note=` take three marks: `code`, **bold** and *italic*. Words on the stage stay plain.

```animation layout=graph
person dev "you"
box repo "repo" note="Holds the `contract.yaml` and the **generated** files."
box ci "CI"
@step You run `task gen`; it is **never** done by *hand*.
dev -> repo "task gen"
say dev: I ran `task gen` first
@step CI checks that the **generated** files match.
repo -> ci "push"
@step Click the repo to read its note: it uses `code` and **bold** too.
highlight repo
```

:::accordion
#### Source: `fixtures/format/93-animation-inline-marks.dh.md`
````text
---
title: "Animation: code, bold and italic in captions"
description: Captions, speech and notes take three marks (SPEC 6.15); words on the stage stay plain.
---

## Animation: code, bold and italic in captions

Captions, `say` and `note=` take three marks: `code`, **bold** and *italic*. Words on the stage stay plain.

```animation layout=graph
person dev "you"
box repo "repo" note="Holds the `contract.yaml` and the **generated** files."
box ci "CI"
@step You run `task gen`; it is **never** done by *hand*.
dev -> repo "task gen"
say dev: I ran `task gen` first
@step CI checks that the **generated** files match.
repo -> ci "push"
@step Click the repo to read its note: it uses `code` and **bold** too.
highlight repo
```
````
:::


## Animation: long paths in labels

A path breaks only after a `/`, on a laptop and on a phone, and always keeps the name of its file.

```animation layout=graph dir=down
box src "features/checkout/observability/contract.yaml"
box out "internal/wiring/registry/providers.go"
box dash "observability/dashboards/checkout-overview.json"
src -> out "task gen"
src -> dash
@step The contract is the one source.
highlight src
@step One run generates both files from it.
highlight out dash
```

:::accordion
#### Source: `fixtures/format/94-animation-long-paths-in-labels.dh.md`
````text
---
title: "Animation: long paths in labels"
description: A path breaks only after a slash, on a laptop and on a phone, and always keeps the name of its file (SPEC 6.15).
---

## Animation: long paths in labels

A path breaks only after a `/`, on a laptop and on a phone, and always keeps the name of its file.

```animation layout=graph dir=down
box src "features/checkout/observability/contract.yaml"
box out "internal/wiring/registry/providers.go"
box dash "observability/dashboards/checkout-overview.json"
src -> out "task gen"
src -> dash
@step The contract is the one source.
highlight src
@step One run generates both files from it.
highlight out dash
```
````
:::


## Animation: a sent token becomes an item

`send ... as <id>` into a queue, a stack or a list leaves the token there as an item, so a later line can take it out.

```animation layout=graph
box app "app"
queue buf "send buffer"
box net "network"
app -> buf
buf -> net
@step The app sends a segment into the buffer.
send "seg 1" app -> buf as s1
@step The network reads the oldest segment.
pop buf to net
```

:::accordion
#### Source: `fixtures/format/95-animation-sent-items.dh.md`
````text
---
title: "Animation: a sent token becomes an item"
description: A token sent into a queue joins it as an item that pop and move work on (SPEC 6.15).
---

## Animation: a sent token becomes an item

`send ... as <id>` into a queue, a stack or a list leaves the token there as an item, so a later line can take it out.

```animation layout=graph
box app "app"
queue buf "send buffer"
box net "network"
app -> buf
buf -> net
@step The app sends a segment into the buffer.
send "seg 1" app -> buf as s1
@step The network reads the oldest segment.
pop buf to net
```
````
:::

# The composed stage


## Animation: a composed stage

An animation is **composed** by default: lanes left to right, cards with lines and badges, bands under lanes, then steps that show, light, tag and connect. The stage is laid out once for every step, so nothing moves; connectors are drawn after layout, from fanned ports, with their labels in the gap between lanes. Colours come from the page's `roles:` in the front matter, one per role on the whole page. A phone stacks the lanes. `layout=graph` on the fence sends a scene to the graph engine below instead.

```animation
title: Orders | one request, end to end
## Browsers
client b1..b4: laptop; phone; tablet; kiosk | sends GET /orders
... about 2,000 sessions
## Servers
server s0,s1: api 0; api 1 | answers in JSON
  + (a) worker a; (b) worker b
## Storage
store db: orders database | primary | region east
## _ under Servers..Storage
ops cfg: config service | pushes routes and limits
@step Ask: Each browser asks one server.
b1,b3 --> s0: GET
b2,b4 --> s1: GET
tag b1,b3: to api 0
tag b2,b4: to api 1
light s0,s1
@step Read: The servers read from the database.
s0,s1 --> db (store): SELECT
say db: one primary
light db
@step Config: The config service is off the data path.
cfg -> s1, db: polled
light cfg
@step In short: Browsers pull from servers; servers read one database.
key client: GET  browser to server
key store: SELECT  server to database
```

:::accordion
#### Source: `fixtures/stage/01-animation-a-composed-stage.dh.md`
````text
---
title: "Animation: a composed stage"
description: A fixture made from the Format page section of the same name (a composed stage).
roles:
  client: c1
  server: c2
  store: c3
  job: c4
  cache: c5
  ops: c6
  plain: c0
---

## Animation: a composed stage

An animation is **composed** by default: lanes left to right, cards with lines and badges, bands under lanes, then steps that show, light, tag and connect. The stage is laid out once for every step, so nothing moves; connectors are drawn after layout, from fanned ports, with their labels in the gap between lanes. Colours come from the page's `roles:` in the front matter, one per role on the whole page. A phone stacks the lanes. `layout=graph` on the fence sends a scene to the graph engine below instead.

```animation
title: Orders | one request, end to end
## Browsers
client b1..b4: laptop; phone; tablet; kiosk | sends GET /orders
... about 2,000 sessions
## Servers
server s0,s1: api 0; api 1 | answers in JSON
  + (a) worker a; (b) worker b
## Storage
store db: orders database | primary | region east
## _ under Servers..Storage
ops cfg: config service | pushes routes and limits
@step Ask: Each browser asks one server.
b1,b3 --> s0: GET
b2,b4 --> s1: GET
tag b1,b3: to api 0
tag b2,b4: to api 1
light s0,s1
@step Read: The servers read from the database.
s0,s1 --> db (store): SELECT
say db: one primary
light db
@step Config: The config service is off the data path.
cfg -> s1, db: polled
light cfg
@step In short: Browsers pull from servers; servers read one database.
key client: GET  browser to server
key store: SELECT  server to database
```
````
:::


## Animation: a phase strip and swapped panels

A `track:` is a strip of phases, coloured by role; `at` puts each step on it, and `carry:` follows the step. A panel (`grid`, `rows`, `map`, `list`) shows only in its step, in one region as tall as the tallest, so the page does not jump. A grid item ends with a verdict, `[+ kept]` or `[- why]`.

```animation
track: job fetch, resolve | cache lookup | job build, test | store publish
carry: one package
where: a monorepo of 40 packages · the main branch
@step Resolve: Every package is listed; drafts and private ones are dropped.
at resolve
grid 2
  job: ui-kit | 3.2.0 · ready [+ kept]
  job: router | 1.9.4 · ready [+ kept]
  job: icons | 0.8.0 · draft [- draft: skip]
  job: internal-tools | 0.1.0 · private [- private: skip]
foot: only ready, public packages go on
@step Cache: Each package's hash picks its cache shard.
at lookup
rows
  ui-kit ; 3.2.0 | hash = 0x51a2 ; * shard 2 of 8 | => cache: cache shard 2 | a hit ; built before
  router ; 1.9.4 | hash = 0x9f07 ; * shard 7 of 8 | => cache: cache shard 7 | ! a miss ; build it
  ! a miss sends the package on to build
@step Publish: The built package is renamed for the registry.
at publish
map rename
  job: router 1.9.4
  built from the main branch
  to
  + name; + version; + licence; - source maps; - test files
```

:::accordion
#### Source: `fixtures/stage/02-animation-a-phase-strip-and-swapped-panels.dh.md`
````text
---
title: "Animation: a phase strip and swapped panels"
description: A fixture made from the Format page section of the same name (a composed stage).
roles:
  client: c1
  server: c2
  store: c3
  job: c4
  cache: c5
  ops: c6
  plain: c0
---

## Animation: a phase strip and swapped panels

A `track:` is a strip of phases, coloured by role; `at` puts each step on it, and `carry:` follows the step. A panel (`grid`, `rows`, `map`, `list`) shows only in its step, in one region as tall as the tallest, so the page does not jump. A grid item ends with a verdict, `[+ kept]` or `[- why]`.

```animation
track: job fetch, resolve | cache lookup | job build, test | store publish
carry: one package
where: a monorepo of 40 packages · the main branch
@step Resolve: Every package is listed; drafts and private ones are dropped.
at resolve
grid 2
  job: ui-kit | 3.2.0 · ready [+ kept]
  job: router | 1.9.4 · ready [+ kept]
  job: icons | 0.8.0 · draft [- draft: skip]
  job: internal-tools | 0.1.0 · private [- private: skip]
foot: only ready, public packages go on
@step Cache: Each package's hash picks its cache shard.
at lookup
rows
  ui-kit ; 3.2.0 | hash = 0x51a2 ; * shard 2 of 8 | => cache: cache shard 2 | a hit ; built before
  router ; 1.9.4 | hash = 0x9f07 ; * shard 7 of 8 | => cache: cache shard 7 | ! a miss ; build it
  ! a miss sends the package on to build
@step Publish: The built package is renamed for the registry.
at publish
map rename
  job: router 1.9.4
  built from the main branch
  to
  + name; + version; + licence; - source maps; - test files
```
````
:::


## Animation: a worksheet

A `sheet:` lines up values in cells per row, rows in groups, and one outcome column. Steps `mark` a cell, give each row a `value`, `sum` a group (its result goes to the outcome column next) and write the `total`; `note:` and `= ...` are bands under the stage.

```animation
title: Takings | per hour, two shops
sheet: two shops, each with its own tills | 3 tills
server s0: shop north | 2 tills
  plain t1 "till 1": 40 55 70 85 20 35 50
  plain t2 "till 2": 10 20 30 40 50 60 70
server s1: shop south | 1 till
  plain t3 "till 3": 100 130 160 190 220 250 280
=> store out: head office | adds the shops
@step Counts: Each till's running count, read every 10 minutes.
@step Emptied: A drop means the till was emptied; the count before it is added back.
mark t1 5: bad +85
note: till 1 was emptied | 85 then 20 goes down: the till was emptied | so 85 is added back
@step Per hour: Each till's increase over the hour.
value t1 t2 t3: per hour | 95, 60, 180
@step Shops: Each shop adds its own tills.
sum s0: shop north | 95 + 60 = 155 -> 155
sum s1: shop south | 180 -> 180
@step Office: The office adds the shops.
total out: 155 + 180 = 335 => takings per hour | 335
aside out: an emptied till loses nothing
```

:::accordion
#### Source: `fixtures/stage/03-animation-a-worksheet.dh.md`
````text
---
title: "Animation: a worksheet"
description: A fixture made from the Format page section of the same name (a composed stage).
roles:
  client: c1
  server: c2
  store: c3
  job: c4
  cache: c5
  ops: c6
  plain: c0
---

## Animation: a worksheet

A `sheet:` lines up values in cells per row, rows in groups, and one outcome column. Steps `mark` a cell, give each row a `value`, `sum` a group (its result goes to the outcome column next) and write the `total`; `note:` and `= ...` are bands under the stage.

```animation
title: Takings | per hour, two shops
sheet: two shops, each with its own tills | 3 tills
server s0: shop north | 2 tills
  plain t1 "till 1": 40 55 70 85 20 35 50
  plain t2 "till 2": 10 20 30 40 50 60 70
server s1: shop south | 1 till
  plain t3 "till 3": 100 130 160 190 220 250 280
=> store out: head office | adds the shops
@step Counts: Each till's running count, read every 10 minutes.
@step Emptied: A drop means the till was emptied; the count before it is added back.
mark t1 5: bad +85
note: till 1 was emptied | 85 then 20 goes down: the till was emptied | so 85 is added back
@step Per hour: Each till's increase over the hour.
value t1 t2 t3: per hour | 95, 60, 180
@step Shops: Each shop adds its own tills.
sum s0: shop north | 95 + 60 = 155 -> 155
sum s1: shop south | 180 -> 180
@step Office: The office adds the shops.
total out: 155 + 180 = 335 => takings per hour | 335
aside out: an emptied till loses nothing
```
````
:::


## Animation: a swimlane matrix

A `matrix:` crosses **lanes** (rows) with **columns** (`column id: Title`) into cells; each cell holds cards, chips and an "and more" line. `light lane.column: words` lights a cell with a few words under its contents; `show t4` brings a card in and `light t3` puts one in focus. Every cell and card has its place from the first step, so nothing moves. A phone stacks the matrix by lane: each lane is a block, with its columns as small headings.

```animation
title: A photo upload | who does what, stage by stage
matrix: Who holds the photo | five parts, four stages
column sb: Submit | the request
column qu: Queue | waits for a worker
column rn: Run | the work
column rp: Report | the answer
client c: Browser | the person
  sb: [u1] Upload | 4 MB, one file
  rp: [u3] Done page | thumbnail shown
server a: API | checks and accepts
  sb: [a1] Accept | size and type checked; + [r202] 202
  rp: [a2] Status | answers polling
job w: Worker | does the slow part
  rn: [w1] Resize | three sizes; + strip metadata
cache k: Job queue | keeps the order
  qu: [q1] Waiting job | first in, first out; ... about 30 more
store s: Storage | keeps the files
  rn: + [orig] original; + [sizes] 3 sizes
@step Send: The browser sends the file.
light c.sb: the request leaves
light u1
@step Accept: The API checks it and queues a job.
show r202
light a.sb: 202 sent back
light k.qu: one more waiting
@step Work: A worker takes the job and writes the sizes.
light w.rn
show orig, sizes
light s.rn: files written
@step Done: The browser polls and shows the result.
show u3
light c.rp, a.rp
```

:::accordion
#### Source: `fixtures/stage/04-animation-a-swimlane-matrix.dh.md`
````text
---
title: "Animation: a swimlane matrix"
description: A fixture made from the Format page section of the same name (a composed stage).
roles:
  client: c1
  server: c2
  store: c3
  job: c4
  cache: c5
  ops: c6
  plain: c0
---

## Animation: a swimlane matrix

A `matrix:` crosses **lanes** (rows) with **columns** (`column id: Title`) into cells; each cell holds cards, chips and an "and more" line. `light lane.column: words` lights a cell with a few words under its contents; `show t4` brings a card in and `light t3` puts one in focus. Every cell and card has its place from the first step, so nothing moves. A phone stacks the matrix by lane: each lane is a block, with its columns as small headings.

```animation
title: A photo upload | who does what, stage by stage
matrix: Who holds the photo | five parts, four stages
column sb: Submit | the request
column qu: Queue | waits for a worker
column rn: Run | the work
column rp: Report | the answer
client c: Browser | the person
  sb: [u1] Upload | 4 MB, one file
  rp: [u3] Done page | thumbnail shown
server a: API | checks and accepts
  sb: [a1] Accept | size and type checked; + [r202] 202
  rp: [a2] Status | answers polling
job w: Worker | does the slow part
  rn: [w1] Resize | three sizes; + strip metadata
cache k: Job queue | keeps the order
  qu: [q1] Waiting job | first in, first out; ... about 30 more
store s: Storage | keeps the files
  rn: + [orig] original; + [sizes] 3 sizes
@step Send: The browser sends the file.
light c.sb: the request leaves
light u1
@step Accept: The API checks it and queues a job.
show r202
light a.sb: 202 sent back
light k.qu: one more waiting
@step Work: A worker takes the job and writes the sizes.
light w.rn
show orig, sizes
light s.rn: files written
@step Done: The browser polls and shows the result.
show u3
light c.rp, a.rp
```
````
:::


## Animation: time

A `time:` block is a real axis: a tick ruler, rows of states, and per step a marker (`at`) or a bracket over a span (`span`). Every mark sits at its true place.

```animation
title: A pipeline | build, then test, then deploy
time: 0..60 | seconds
row job j1 "build": queued 0..4; +running 4..31; done 31..60
row job j2 "test": queued 0..31; +running 31..52; done 52..60
row server d1 "deploy": waiting 0..52; +rolling 52..60
@step Build: The build runs first, for 27 seconds.
span j1 4..31: 27 s
@step Test: The test starts when the build ends.
at 31: build done
@step Deploy: The deploy starts at 52 seconds.
at 52: tests pass
```

:::accordion
#### Source: `fixtures/stage/05-animation-time.dh.md`
````text
---
title: "Animation: time"
description: A fixture made from the Format page section of the same name (a composed stage).
roles:
  client: c1
  server: c2
  store: c3
  job: c4
  cache: c5
  ops: c6
  plain: c0
---

## Animation: time

A `time:` block is a real axis: a tick ruler, rows of states, and per step a marker (`at`) or a bracket over a span (`span`). Every mark sits at its true place.

```animation
title: A pipeline | build, then test, then deploy
time: 0..60 | seconds
row job j1 "build": queued 0..4; +running 4..31; done 31..60
row job j2 "test": queued 0..31; +running 31..52; done 52..60
row server d1 "deploy": waiting 0..52; +rolling 52..60
@step Build: The build runs first, for 27 seconds.
span j1 4..31: 27 s
@step Test: The test starts when the build ends.
at 31: build done
@step Deploy: The deploy starts at 52 seconds.
at 52: tests pass
```
````
:::


## Animation: time up close

The full ruler and an enlarged inset share the same data. The handoff marker stays at 30 seconds, and progress uses a continuous value axis. A narrow page stacks the inset below the overview.

```animation
title: A studio export | prepare, render, deliver
time: 0..60 | seconds
ticks: 0, 15, 30, 45, 60
row job export "export": +prepare 0..24; +render 24..36; delivered 36..60
row server review "review": waiting 0..30; +checking 30..45; accepted 45..60
at 30: 30 s, review starts
zoom: 24..36 | Close-up
plot: 0..100 | percent complete
point job start at 0: 0 | Start
point job prepared at 24: 25 | Prepared
point job halfway at 30: 50 | Halfway
point job rendered at 36: 75 | Rendered
point job finish at 60: 100 | Complete
@step Prepare: Preparation takes the first 24 seconds.
span export 0..24: preparation
@step Handoff: Review begins halfway through rendering.
at 30: halfway
span export 24..36: rendering
@step Deliver: The export finishes before review ends.
at 36: export complete
```

:::accordion
#### Source: `fixtures/stage/06-animation-time-up-close.dh.md`
````text
---
title: "Animation: time up close"
description: A fixture made from the Format page section of the same name (a composed stage).
roles:
  client: c1
  server: c2
  store: c3
  job: c4
  cache: c5
  ops: c6
  plain: c0
---

## Animation: time up close

The full ruler and an enlarged inset share the same data. The handoff marker stays at 30 seconds, and progress uses a continuous value axis. A narrow page stacks the inset below the overview.

```animation
title: A studio export | prepare, render, deliver
time: 0..60 | seconds
ticks: 0, 15, 30, 45, 60
row job export "export": +prepare 0..24; +render 24..36; delivered 36..60
row server review "review": waiting 0..30; +checking 30..45; accepted 45..60
at 30: 30 s, review starts
zoom: 24..36 | Close-up
plot: 0..100 | percent complete
point job start at 0: 0 | Start
point job prepared at 24: 25 | Prepared
point job halfway at 30: 50 | Halfway
point job rendered at 36: 75 | Rendered
point job finish at 60: 100 | Complete
@step Prepare: Preparation takes the first 24 seconds.
span export 0..24: preparation
@step Handoff: Review begins halfway through rendering.
at 30: halfway
span export 24..36: rendering
@step Deliver: The export finishes before review ends.
at 36: export complete
```
````
:::


## Animation: counted units

Each square is one unit. The grid includes the unassigned remainder, so the total can be counted directly.

```animation
title: A sample library | one square per clip
units 64: kept 16, added 8, removed 4
```

:::accordion
#### Source: `fixtures/stage/07-animation-counted-units.dh.md`
````text
---
title: "Animation: counted units"
description: A fixture made from the Format page section of the same name (a composed stage).
roles:
  client: c1
  server: c2
  store: c3
  job: c4
  cache: c5
  ops: c6
  plain: c0
---

## Animation: counted units

Each square is one unit. The grid includes the unassigned remainder, so the total can be counted directly.

```animation
title: A sample library | one square per clip
units 64: kept 16, added 8, removed 4
```
````
:::


## Animation: time detail, static

The same real axes can be printed as a selected step. The marker, inset and values keep their places.

```animation static=2
title: A studio export | the handoff, held still
time: 0..60 | seconds
row job export "export": +prepare 0..24; +render 24..36; delivered 36..60
at 30: 30 s, review starts
zoom: 24..36 | Close-up
plot: 0..100 | percent complete
point job start at 0: 0 | Start
point job halfway at 30: 50 | Halfway
point job finish at 60: 100 | Complete
@step Prepare: The first 24 seconds prepare the export.
span export 0..24: preparation
@step Handoff: Review begins halfway through rendering.
at 30: halfway
```

:::accordion
#### Source: `fixtures/stage/08-animation-time-detail-static.dh.md`
````text
---
title: "Animation: time detail, static"
description: A fixture made from the Format page section of the same name (a composed stage).
roles:
  client: c1
  server: c2
  store: c3
  job: c4
  cache: c5
  ops: c6
  plain: c0
---

## Animation: time detail, static

The same real axes can be printed as a selected step. The marker, inset and values keep their places.

```animation static=2
title: A studio export | the handoff, held still
time: 0..60 | seconds
row job export "export": +prepare 0..24; +render 24..36; delivered 36..60
at 30: 30 s, review starts
zoom: 24..36 | Close-up
plot: 0..100 | percent complete
point job start at 0: 0 | Start
point job halfway at 30: 50 | Halfway
point job finish at 60: 100 | Complete
@step Prepare: The first 24 seconds prepare the export.
span export 0..24: preparation
@step Handoff: Review begins halfway through rendering.
at 30: halfway
```
````
:::


## Animation: units on a ruler

Every cell is one hour. State changes, markers and spans use the same ruler.

```animation
title: A workshop day | one cell per hour
time: 0..12 | hours
cells: 1
ticks: 0, 3, 6, 9, 12
row job batch "batch": queued 0..3; +working 3..9; done 9..12 @2
row server pack "packing": _ 0..6 [dashed]; hold 6..7 @1 [warn]; +box 6..7 @2 [lit]; packing 7..11 @2 [good]; done 11..12 @2
at 6: packing begins
@step Make: The batch takes six hours to make.
keep span batch 3..9 [warn]: six hours
@step Pack: Packing overlaps the last three hours of making.
keep at 6 [bad]: both are active
```

:::accordion
#### Source: `fixtures/stage/09-animation-units-on-a-ruler.dh.md`
````text
---
title: "Animation: units on a ruler"
description: A fixture made from the Format page section of the same name (a composed stage).
roles:
  client: c1
  server: c2
  store: c3
  job: c4
  cache: c5
  ops: c6
  plain: c0
---

## Animation: units on a ruler

Every cell is one hour. State changes, markers and spans use the same ruler.

```animation
title: A workshop day | one cell per hour
time: 0..12 | hours
cells: 1
ticks: 0, 3, 6, 9, 12
row job batch "batch": queued 0..3; +working 3..9; done 9..12 @2
row server pack "packing": _ 0..6 [dashed]; hold 6..7 @1 [warn]; +box 6..7 @2 [lit]; packing 7..11 @2 [good]; done 11..12 @2
at 6: packing begins
@step Make: The batch takes six hours to make.
keep span batch 3..9 [warn]: six hours
@step Pack: Packing overlaps the last three hours of making.
keep at 6 [bad]: both are active
```
````
:::


## Animation: counted pieces beside a card

Counted rows can sit beside another step panel. The role before the parentheses colours the squares; the role inside colours the badge. Plain and muted text follow the counts.

```animation
title: A copy desk | counted pieces
@step Leaving: Some pieces are leaving each desk.
card job: Draft | A copy remains here.
beside
units Stored pieces | One square is one piece.
  job (client) 12: kept 8, leaving 4
  job (server) 12: kept 10, leaving 2
  c, the client desk: 8 kept, 4 leaving.
  s, the server desk: 10 kept, 2 leaving.
  ~ Thick borders show departing pieces.
@step Gone: The departed pieces are faint.
card job: Draft | The retained copy is ready.
beside
units Stored pieces | One square is one piece.
  job (client) 12: kept 8, gone 4
  job (server) 12: kept 10, gone 2
  c, the client desk: 8 kept, 4 gone.
  s, the server desk: 10 kept, 2 gone.
  ~ Faint squares show departed pieces.
```

:::accordion
#### Source: `fixtures/stage/14-animation-counted-pieces-beside-a-card.dh.md`
````text
---
title: "Animation: counted pieces beside a card"
description: A fixture made from the Format page section of the same name (a composed stage).
roles:
  client: c1
  server: c2
  store: c3
  job: c4
  cache: c5
  ops: c6
  plain: c0
---

## Animation: counted pieces beside a card

Counted rows can sit beside another step panel. The role before the parentheses colours the squares; the role inside colours the badge. Plain and muted text follow the counts.

```animation
title: A copy desk | counted pieces
@step Leaving: Some pieces are leaving each desk.
card job: Draft | A copy remains here.
beside
units Stored pieces | One square is one piece.
  job (client) 12: kept 8, leaving 4
  job (server) 12: kept 10, leaving 2
  c, the client desk: 8 kept, 4 leaving.
  s, the server desk: 10 kept, 2 leaving.
  ~ Thick borders show departing pieces.
@step Gone: The departed pieces are faint.
card job: Draft | The retained copy is ready.
beside
units Stored pieces | One square is one piece.
  job (client) 12: kept 8, gone 4
  job (server) 12: kept 10, gone 2
  c, the client desk: 8 kept, 4 gone.
  s, the server desk: 10 kept, 2 gone.
  ~ Faint squares show departed pieces.
```
````
:::


## Animation: cards inside cards

A card line indented under a card is a card **inside** it (one level). The outer card is as tall as what it holds, and a connector to or from an inner card starts or ends at the card that holds it, so no line crosses a card. A title may end in a state word, `[+ open]` (good) or `[- shut]` (bad), that a step changes with `state`; `text id: line | line` gives a card new lines from that step on; `dashed` draws a card that is not there yet, and `dashed id off` makes it solid. `## Desk across Branches..Readers` is a band whose cards run left to right in one row; a line `next row` starts the row under them, centred.

```animation
title: A library | books between branches
## Branches
store h: main branch | two floors | open late
  store f1: ground floor [+ open] | returns desk
  store f2: top floor [- shut] | reading room
## Vans
job v: book van | one driver
  job v1: morning run | 8 stops
  job v2: evening run | 5 stops
## Readers
client r: readers
  client r1: card holder | borrows 3
  client r2: new reader | no card yet
## Desk across Branches..Readers
ops a: check in
ops b: shelve
ops c: lend
next row
ops d: repair
@step Morning: Books leave the main branch on the morning van.
dashed r2
f1 -> v: 40 books
v1 -> r: drop-off
@step Evening: The top floor opens and a new reader joins.
state f2: [+ open]
text v2: 5 stops | and the late club
dashed r2 off
tag r2: joined
say v2: runs late tonight and comes back by ten | one driver
say v2: no stops on the hill
@step Desk: Every book goes through the desk, one step at a time.
clear
a --> b: next
b --> c: next
d -> b: mended
```

:::accordion
#### Source: `fixtures/stage/15-animation-cards-inside-cards.dh.md`
````text
---
title: "Animation: cards inside cards"
description: A fixture made from the Format page section of the same name (a composed stage).
roles:
  client: c1
  server: c2
  store: c3
  job: c4
  cache: c5
  ops: c6
  plain: c0
---

## Animation: cards inside cards

A card line indented under a card is a card **inside** it (one level). The outer card is as tall as what it holds, and a connector to or from an inner card starts or ends at the card that holds it, so no line crosses a card. A title may end in a state word, `[+ open]` (good) or `[- shut]` (bad), that a step changes with `state`; `text id: line | line` gives a card new lines from that step on; `dashed` draws a card that is not there yet, and `dashed id off` makes it solid. `## Desk across Branches..Readers` is a band whose cards run left to right in one row; a line `next row` starts the row under them, centred.

```animation
title: A library | books between branches
## Branches
store h: main branch | two floors | open late
  store f1: ground floor [+ open] | returns desk
  store f2: top floor [- shut] | reading room
## Vans
job v: book van | one driver
  job v1: morning run | 8 stops
  job v2: evening run | 5 stops
## Readers
client r: readers
  client r1: card holder | borrows 3
  client r2: new reader | no card yet
## Desk across Branches..Readers
ops a: check in
ops b: shelve
ops c: lend
next row
ops d: repair
@step Morning: Books leave the main branch on the morning van.
dashed r2
f1 -> v: 40 books
v1 -> r: drop-off
@step Evening: The top floor opens and a new reader joins.
state f2: [+ open]
text v2: 5 stops | and the late club
dashed r2 off
tag r2: joined
say v2: runs late tonight and comes back by ten | one driver
say v2: no stops on the hill
@step Desk: Every book goes through the desk, one step at a time.
clear
a --> b: next
b --> c: next
d -> b: mended
```
````
:::


## Animation: pills that move

`pill ids: words; words` under a card stacks pills at its foot. `move p3 to w` draws the pill in the other card from that step on; both cards keep a place for it, so nothing else moves. `light p1: note` lights a pill with a note at its right end, `tone id bad` (or `good`, `warn`, `accent`, `off`) and `dim id` change a card from that step on, and `align: top` gives the cards of a row one top and one foot.

```animation
title: Bakery shelves | trays move as they sell
align: top
## Oven
job o: oven | batch 1
cache t: timer | 20 minutes
## Shelf A
server sa: shelf A | by the door
  pill p1,p2,p3: rye · fresh; spelt · fresh; oat · cooling
## Shelf B
server sb: shelf B | at the back
  pill p4: seed · fresh
## Window
client w: window | on the street
  pill p5: brioche · on show
@step Bake: The oven fills shelf A.
o -> sa: trays
@step Sell: Rye sells out and the oat loaf moves to the window.
move p3 to w
light p1: sold
dim p1
text sa: rye is gone | spelt stays
@step Late: Shelf B runs low and closes; the timer is off.
tone sb bad
dim t
text sb: closed for the night
```

:::accordion
#### Source: `fixtures/stage/16-animation-pills-that-move.dh.md`
````text
---
title: "Animation: pills that move"
description: A fixture made from the Format page section of the same name (a composed stage).
roles:
  client: c1
  server: c2
  store: c3
  job: c4
  cache: c5
  ops: c6
  plain: c0
---

## Animation: pills that move

`pill ids: words; words` under a card stacks pills at its foot. `move p3 to w` draws the pill in the other card from that step on; both cards keep a place for it, so nothing else moves. `light p1: note` lights a pill with a note at its right end, `tone id bad` (or `good`, `warn`, `accent`, `off`) and `dim id` change a card from that step on, and `align: top` gives the cards of a row one top and one foot.

```animation
title: Bakery shelves | trays move as they sell
align: top
## Oven
job o: oven | batch 1
cache t: timer | 20 minutes
## Shelf A
server sa: shelf A | by the door
  pill p1,p2,p3: rye · fresh; spelt · fresh; oat · cooling
## Shelf B
server sb: shelf B | at the back
  pill p4: seed · fresh
## Window
client w: window | on the street
  pill p5: brioche · on show
@step Bake: The oven fills shelf A.
o -> sa: trays
@step Sell: Rye sells out and the oat loaf moves to the window.
move p3 to w
light p1: sold
dim p1
text sa: rye is gone | spelt stays
@step Late: Shelf B runs low and closes; the timer is off.
tone sb bad
dim t
text sb: closed for the night
```
````
:::


## Animation: token chips and a record

`tokens: ...` under a card lays out its words as chips, in order, wrapped. `mark id word, word: tone remark` boxes some in a tone for that step only, with the remark under their row (a word with a comma is named without it, or by its place, `#3`). `keys: A; B` makes the card a record whose values read `...` until a step fills them: `fill id A, B: value; value`. The record keeps its size on every step.

```animation
title: Reading a recipe line | words become a plan
## _
plain q: the line
  tokens: mix ( flour, sugar, salt ) then bake ( 180C, 25min )
store r: the plan
  keys: Action; Inputs; Then; Heat; Time
@step Read: The line is read word by word; the plan is still empty.
@step Mix: The first call names what to mix.
mark q mix, flour, sugar, salt: accent
fill r Action, Inputs: mix; flour, sugar, salt
@step Drop: Salt is optional here, so it is dropped.
mark q salt: bad dropped: optional
fill r Inputs: flour, sugar
@step Bake: Then the oven, hot and for a time.
mark q bake, 180C, 25min: accent
fill r Then, Heat, Time: bake; 180C; 25 minutes
```

:::accordion
#### Source: `fixtures/stage/17-animation-token-chips-and-a-record.dh.md`
````text
---
title: "Animation: token chips and a record"
description: A fixture made from the Format page section of the same name (a composed stage).
roles:
  client: c1
  server: c2
  store: c3
  job: c4
  cache: c5
  ops: c6
  plain: c0
---

## Animation: token chips and a record

`tokens: ...` under a card lays out its words as chips, in order, wrapped. `mark id word, word: tone remark` boxes some in a tone for that step only, with the remark under their row (a word with a comma is named without it, or by its place, `#3`). `keys: A; B` makes the card a record whose values read `...` until a step fills them: `fill id A, B: value; value`. The record keeps its size on every step.

```animation
title: Reading a recipe line | words become a plan
## _
plain q: the line
  tokens: mix ( flour, sugar, salt ) then bake ( 180C, 25min )
store r: the plan
  keys: Action; Inputs; Then; Heat; Time
@step Read: The line is read word by word; the plan is still empty.
@step Mix: The first call names what to mix.
mark q mix, flour, sugar, salt: accent
fill r Action, Inputs: mix; flour, sugar, salt
@step Drop: Salt is optional here, so it is dropped.
mark q salt: bad dropped: optional
fill r Inputs: flour, sugar
@step Bake: Then the oven, hot and for a time.
mark q bake, 180C, 25min: accent
fill r Then, Heat, Time: bake; 180C; 25 minutes
```
````
:::


## Animation: two arrows, one label each

A connector line of one pair keeps its own label: two lines that both say `30 crates` show it on both arrows. A line of several pairs, `m -> s, t: 12 each`, shows its label once for the bundle, and so do such lines with one label across one gap.

```animation
title: A market morning | crates in, crates out
## Farms
job a: hill farm | apples
job b: river farm | pears
## Market
store m: market hall | one floor
## Shops
client s: corner shop
client t: station kiosk
@step Arrive: Both farms bring the same load.
a -> m: 30 crates
b -> m: 30 crates
@step Share: The hall sends some on, the same to each shop.
m -> s, t: 12 each
@step Again: Next morning the hill farm comes again with the same load.
clear
a -> m: 30 crates
```

:::accordion
#### Source: `fixtures/stage/18-animation-two-arrows-one-label-each.dh.md`
````text
---
title: "Animation: two arrows, one label each"
description: A fixture made from the Format page section of the same name (a composed stage).
roles:
  client: c1
  server: c2
  store: c3
  job: c4
  cache: c5
  ops: c6
  plain: c0
---

## Animation: two arrows, one label each

A connector line of one pair keeps its own label: two lines that both say `30 crates` show it on both arrows. A line of several pairs, `m -> s, t: 12 each`, shows its label once for the bundle, and so do such lines with one label across one gap.

```animation
title: A market morning | crates in, crates out
## Farms
job a: hill farm | apples
job b: river farm | pears
## Market
store m: market hall | one floor
## Shops
client s: corner shop
client t: station kiosk
@step Arrive: Both farms bring the same load.
a -> m: 30 crates
b -> m: 30 crates
@step Share: The hall sends some on, the same to each shop.
m -> s, t: 12 each
@step Again: Next morning the hill farm comes again with the same load.
clear
a -> m: 30 crates
```
````
:::


## Animation: a key

With the setup line `key at: top right`, the scene's `key role: words; words` entries form a legend at the stage's top right, each a small swatch in the role's colour with its words beside it. An entry shows from the step that writes it; its place is kept from the start, so nothing moves. Without that line the key stays at the bottom left.

```animation
title: A bike shop | parts in, bikes out
key at: top right
## Store room
store p: parts shelf | wheels, chains
## Bench
job f: fitter | one bench
## Door
client c: rider
@step Parts: The fitter takes parts from the shelf.
p -> f: two wheels
key store: kept in stock
key job: work done here
@step Ride: The bike goes out of the door.
f -> c: one bike
key client: who it is for
```

:::accordion
#### Source: `fixtures/stage/19-animation-a-key.dh.md`
````text
---
title: "Animation: a key"
description: A fixture made from the Format page section of the same name (a composed stage).
roles:
  client: c1
  server: c2
  store: c3
  job: c4
  cache: c5
  ops: c6
  plain: c0
---

## Animation: a key

With the setup line `key at: top right`, the scene's `key role: words; words` entries form a legend at the stage's top right, each a small swatch in the role's colour with its words beside it. An entry shows from the step that writes it; its place is kept from the start, so nothing moves. Without that line the key stays at the bottom left.

```animation
title: A bike shop | parts in, bikes out
key at: top right
## Store room
store p: parts shelf | wheels, chains
## Bench
job f: fitter | one bench
## Door
client c: rider
@step Parts: The fitter takes parts from the shelf.
p -> f: two wheels
key store: kept in stock
key job: work done here
@step Ride: The bike goes out of the door.
f -> c: one bike
key client: who it is for
```
````
:::


## Animation: boxes inside boxes

A `nest:` draws wrappers as boxes inside boxes, outside first, each with a role, a title, a size and its fields; a field after `> ` sits at the box's end, under what it holds. Every box has its place from the first step, so a wrapper put round later, or taken off, moves nothing. A step can `show` a wrapper, `light` it or one of its fields, give it new `fields` or a new `title`, `set` one field (the old value struck beside the new one, for that step), `unwrap` it (the wrapper comes off what it holds: dashed and struck for that step, then gone) or `hide` it. Fields are written in the mono face, so they line up.

```animation
title: A parcel | wrapped for the trip, unwrapped at the door
nest: The parcel | outside in
  store crate: shipping crate | 40 kg | to the depot; from the warehouse; > seal 7731
  job box: box | 2 kg | to the house; status: packed
  client gift: gift | a mug | wrapped in paper
@step Boxed: The gift goes in a box addressed to the house.
light gift
@step Crated: The box rides in a crate addressed to the depot, not to the house.
show crate
light crate: to the depot
@step At the depot: The crate comes off; the box goes on the van.
unwrap crate
set box: status: packed => status: out for delivery
@step At the door: The box comes off, and the gift is there.
unwrap box
light gift
```

The full example, one web request through a switch, a home router and two internet routers and back, is its own page: [the layers, through several routers](../layers/).

:::accordion
#### Source: `fixtures/stage/20-animation-boxes-inside-boxes.dh.md`
````text
---
title: "Animation: boxes inside boxes"
description: A fixture made from the Format page section of the same name (a composed stage).
roles:
  client: c1
  server: c2
  store: c3
  job: c4
  cache: c5
  ops: c6
  plain: c0
---

## Animation: boxes inside boxes

A `nest:` draws wrappers as boxes inside boxes, outside first, each with a role, a title, a size and its fields; a field after `> ` sits at the box's end, under what it holds. Every box has its place from the first step, so a wrapper put round later, or taken off, moves nothing. A step can `show` a wrapper, `light` it or one of its fields, give it new `fields` or a new `title`, `set` one field (the old value struck beside the new one, for that step), `unwrap` it (the wrapper comes off what it holds: dashed and struck for that step, then gone) or `hide` it. Fields are written in the mono face, so they line up.

```animation
title: A parcel | wrapped for the trip, unwrapped at the door
nest: The parcel | outside in
  store crate: shipping crate | 40 kg | to the depot; from the warehouse; > seal 7731
  job box: box | 2 kg | to the house; status: packed
  client gift: gift | a mug | wrapped in paper
@step Boxed: The gift goes in a box addressed to the house.
light gift
@step Crated: The box rides in a crate addressed to the depot, not to the house.
show crate
light crate: to the depot
@step At the depot: The crate comes off; the box goes on the van.
unwrap crate
set box: status: packed => status: out for delivery
@step At the door: The box comes off, and the gift is there.
unwrap box
light gift
```

The full example, one web request through a switch, a home router and two internet routers and back, is its own page: [the layers, through several routers](../layers/).
````
:::


## Animation: counted columns

A `columns` block is a dot histogram: one column per category, one dot per counted thing, stacked from the bottom. The columns' places are kept for the widest step, so adding columns moves nothing; `new` lights columns in the step that adds them.

```animation
title: A lending library | one dot per book returned
columns 12 store: books returned each month, one dot each, in their month's column | books
  every 3
  labels: Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec
@step First half: Six months: 12 to 31 books a month.
counts 6: 24, 19, 31, 22, 27, 12
@step The year: The second half adds six columns; the summer months are quiet.
counts 12: 24, 19, 31, 22, 27, 12, 9, 11, 28, 30, 26, 35
light Jul..Dec
@step December: December is the busiest month of the year.
light Dec
```

:::accordion
#### Source: `fixtures/stage/21-animation-counted-columns.dh.md`
````text
---
title: "Animation: counted columns"
description: A fixture made from the Format page section of the same name (a composed stage).
roles:
  client: c1
  server: c2
  store: c3
  job: c4
  cache: c5
  ops: c6
  plain: c0
---

## Animation: counted columns

A `columns` block is a dot histogram: one column per category, one dot per counted thing, stacked from the bottom. The columns' places are kept for the widest step, so adding columns moves nothing; `new` lights columns in the step that adds them.

```animation
title: A lending library | one dot per book returned
columns 12 store: books returned each month, one dot each, in their month's column | books
  every 3
  labels: Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec
@step First half: Six months: 12 to 31 books a month.
counts 6: 24, 19, 31, 22, 27, 12
@step The year: The second half adds six columns; the summer months are quiet.
counts 12: 24, 19, 31, 22, 27, 12, 9, 11, 28, 30, 26, 35
light Jul..Dec
@step December: December is the busiest month of the year.
light Dec
```
````
:::


## Animation: a bar chart in a scene

A `bars` block is a small bar chart on one value axis: grid values, reference lines, and per step new values, a dotted peak line, a dashed limit (bars over it light up in its step), and moves from one bar to others, drawn as dashed arrows with the moved amount stacked on the taker. Every bar top and line sits at its true value.

```animation
title: A café | cups sold, by day
bars 7 server: day of the week · bar = cups sold ÷ the weekly average | ×
  axis 0, 0.5, 1, 1.5
  line average: 1
  labels: Mon, Tue, Wed, Thu, Fri, Sat, Sun
  tabs One barista: 1..3; Two baristas: 4
@step Busy Friday: Friday sells 1.4 times the average day.
values: 0.7 0.8 0.9 1.0 1.4 1.3 0.9
peak: busiest 1.4×
heading: cups by day | the week of 3 March
big: 1.4× | busiest ÷ average
@step A cap: No day should go over 1.2 times the average; two days do.
limit 1.2: cap 1.2×
heading: cap = 1.2 × the average · 2 days are over it
@step Move orders: Friday and Saturday hand pre-orders to Monday and Tuesday.
values: 0.9 0.9 0.9 1.0 1.2 1.2 0.9
move 2 from Fri to Mon; 1 from Sat to Tue
peak: busiest 1.2×
big: 1.2× | busiest ÷ average
heading: the moves: Fri → Mon (2 trays), Sat → Tue (1 tray) | the week's total does not change
@step Two baristas: Saturday remains the busiest day; Friday is also above average.
values: 0.9 0.9 1.0 1.0 1.1 1.2 0.9
light Sat: the busiest
heading: two baristas, a month later
```

:::accordion
#### Source: `fixtures/stage/22-animation-a-bar-chart-in-a-scene.dh.md`
````text
---
title: "Animation: a bar chart in a scene"
description: A fixture made from the Format page section of the same name (a composed stage).
roles:
  client: c1
  server: c2
  store: c3
  job: c4
  cache: c5
  ops: c6
  plain: c0
---

## Animation: a bar chart in a scene

A `bars` block is a small bar chart on one value axis: grid values, reference lines, and per step new values, a dotted peak line, a dashed limit (bars over it light up in its step), and moves from one bar to others, drawn as dashed arrows with the moved amount stacked on the taker. Every bar top and line sits at its true value.

```animation
title: A café | cups sold, by day
bars 7 server: day of the week · bar = cups sold ÷ the weekly average | ×
  axis 0, 0.5, 1, 1.5
  line average: 1
  labels: Mon, Tue, Wed, Thu, Fri, Sat, Sun
  tabs One barista: 1..3; Two baristas: 4
@step Busy Friday: Friday sells 1.4 times the average day.
values: 0.7 0.8 0.9 1.0 1.4 1.3 0.9
peak: busiest 1.4×
heading: cups by day | the week of 3 March
big: 1.4× | busiest ÷ average
@step A cap: No day should go over 1.2 times the average; two days do.
limit 1.2: cap 1.2×
heading: cap = 1.2 × the average · 2 days are over it
@step Move orders: Friday and Saturday hand pre-orders to Monday and Tuesday.
values: 0.9 0.9 0.9 1.0 1.2 1.2 0.9
move 2 from Fri to Mon; 1 from Sat to Tue
peak: busiest 1.2×
big: 1.2× | busiest ÷ average
heading: the moves: Fri → Mon (2 trays), Sat → Tue (1 tray) | the week's total does not change
@step Two baristas: Saturday remains the busiest day; Friday is also above average.
values: 0.9 0.9 1.0 1.0 1.1 1.2 0.9
light Sat: the busiest
heading: two baristas, a month later
```
````
:::


## Animation: a package journey

A standalone phase strip connects every adjacent phase, including links that wrap to another row on a phone.

```animation
title: A package journey | fetch through publish
track: job fetch, resolve | cache lookup | job build, test | store publish
carry: one package
@step Resolve: The package starts with its dependencies.
at resolve
@step Cache: The cache answers.
at lookup
@step Publish: The package reaches the registry.
at publish
```

:::accordion
#### Source: `fixtures/stage/24-animation-a-package-journey.dh.md`
````text
---
title: "Animation: a package journey"
description: A fixture made from the Format page section of the same name (a composed stage).
roles:
  client: c1
  server: c2
  store: c3
  job: c4
  cache: c5
  ops: c6
  plain: c0
---

## Animation: a package journey

A standalone phase strip connects every adjacent phase, including links that wrap to another row on a phone.

```animation
title: A package journey | fetch through publish
track: job fetch, resolve | cache lookup | job build, test | store publish
carry: one package
@step Resolve: The package starts with its dependencies.
at resolve
@step Cache: The cache answers.
at lookup
@step Publish: The package reaches the registry.
at publish
```
````
:::


## Animation: bins

A `bins:` block sorts an inventory into named bins. `items p1..p8: words` names the things (one label for all, or one per id split by `;`); `items 40: word` is a count with no names, drawn as small squares. Each `bin role id "Label": the rule | a second line` is one bin, coloured by its role. In a step, `into <bin>: p1, p2..p4` drops those things, or `into <bin>: 12` drops the next 12 left. The block works out the count of each bin, the leftover in the inventory and a running total, and draws them: every thing has one place in the inventory and one reserved slot in its bin, so nothing moves between steps. A narrow screen stacks the bins.

```animation
title: Library returns | one trolley run
bins: Returned books | books
items b1..b9: Atlas; Birds; Cooking; Dunes; Engines; Fungi; Gardens; Harbours; Insects
bin job s "Science": shelves 500 to 599
bin store r "Reference": stays in the building
bin ops h "Home": goes back to a branch
@step Science: Natural history goes to the science shelves.
into s: b2, b4, b6, b9
@step Reference: Two heavy books stay in the building.
into r: b1, b5
@step Branch: Three go back to a branch.
into h: b3, b7, b8
@step Done: Every book has a bin; the inventory is empty.
```

The same block with many unnamed things: each square is one thing, the counts do the talking.

```animation
title: Seed packets | 60 packets, sorted by season
bins: Packets by season | packets
items 60: packet
bin job a "Spring": sow in March
bin store b "Summer": sow in June
bin ops c "Autumn": sow in September
@step Spring: The first batch is spring seed.
into a: 24
@step Summer: Then summer seed.
into b: 20
@step Autumn: Twelve go to autumn; four are left over.
into c: 12
```

A thing can drop again in a later step: it **moves** to another bin, and its old place stays as a dashed outline. `show c` in step 2 makes bin c appear there (its place is reserved from the start); `light c: words` lights a bin with a note in it. `ledger: Photo | Album` (or `... | Album from 0` to number the bins from 0) adds a list of every thing with the number of its bin in each step; a move reads `1 → 3` in the warning tone. A long label wraps inside its chip; it is never cut. `inventory: off` drops the inventory frame when everything is binned in step 1.

```animation
title: Photo albums | nine photos, re-sorted
bins: Albums | photos
items p1..p9: Beach · sunny; Beach · dusk; Hike · summit; Hike · lake; City · night; City · market; Beach · kite; Hike · camp; City · bridge
bin job a "Album 1": the first sort
bin store b "Album 2": the first sort
bin ops c "Album 3": added in step 2
ledger: Photo | Album
inventory: off
@step Two albums: Nine photos sit in two albums.
into a: p1, p2, p7, p3, p4
into b: p5, p6, p8, p9
@step Three albums: A third album appears and four photos move to it.
show c
light c: four photos move here
into c: p3, p4, p8, p9
```

:::accordion
#### Source: `fixtures/stage/34-animation-bins.dh.md`
````text
---
title: "Animation: bins"
description: A fixture made from the Format page section of the same name (a composed stage).
roles:
  client: c1
  server: c2
  store: c3
  job: c4
  cache: c5
  ops: c6
  plain: c0
---

## Animation: bins

A `bins:` block sorts an inventory into named bins. `items p1..p8: words` names the things (one label for all, or one per id split by `;`); `items 40: word` is a count with no names, drawn as small squares. Each `bin role id "Label": the rule | a second line` is one bin, coloured by its role. In a step, `into <bin>: p1, p2..p4` drops those things, or `into <bin>: 12` drops the next 12 left. The block works out the count of each bin, the leftover in the inventory and a running total, and draws them: every thing has one place in the inventory and one reserved slot in its bin, so nothing moves between steps. A narrow screen stacks the bins.

```animation
title: Library returns | one trolley run
bins: Returned books | books
items b1..b9: Atlas; Birds; Cooking; Dunes; Engines; Fungi; Gardens; Harbours; Insects
bin job s "Science": shelves 500 to 599
bin store r "Reference": stays in the building
bin ops h "Home": goes back to a branch
@step Science: Natural history goes to the science shelves.
into s: b2, b4, b6, b9
@step Reference: Two heavy books stay in the building.
into r: b1, b5
@step Branch: Three go back to a branch.
into h: b3, b7, b8
@step Done: Every book has a bin; the inventory is empty.
```

The same block with many unnamed things: each square is one thing, the counts do the talking.

```animation
title: Seed packets | 60 packets, sorted by season
bins: Packets by season | packets
items 60: packet
bin job a "Spring": sow in March
bin store b "Summer": sow in June
bin ops c "Autumn": sow in September
@step Spring: The first batch is spring seed.
into a: 24
@step Summer: Then summer seed.
into b: 20
@step Autumn: Twelve go to autumn; four are left over.
into c: 12
```

A thing can drop again in a later step: it **moves** to another bin, and its old place stays as a dashed outline. `show c` in step 2 makes bin c appear there (its place is reserved from the start); `light c: words` lights a bin with a note in it. `ledger: Photo | Album` (or `... | Album from 0` to number the bins from 0) adds a list of every thing with the number of its bin in each step; a move reads `1 → 3` in the warning tone. A long label wraps inside its chip; it is never cut. `inventory: off` drops the inventory frame when everything is binned in step 1.

```animation
title: Photo albums | nine photos, re-sorted
bins: Albums | photos
items p1..p9: Beach · sunny; Beach · dusk; Hike · summit; Hike · lake; City · night; City · market; Beach · kite; Hike · camp; City · bridge
bin job a "Album 1": the first sort
bin store b "Album 2": the first sort
bin ops c "Album 3": added in step 2
ledger: Photo | Album
inventory: off
@step Two albums: Nine photos sit in two albums.
into a: p1, p2, p7, p3, p4
into b: p5, p6, p8, p9
@step Three albums: A third album appears and four photos move to it.
show c
light c: four photos move here
into c: p3, p4, p8, p9
```
````
:::

# Every folder part

<!-- generated by scripts/parts.ts from the folders under src/parts/: do not edit -->

# The folder parts

Every part that lives in its own folder, with its sample. The Format page shows each as source, drawing and LLM view.

## Audio

An audio part is a player of our own. The wave is drawn from a small peaks file and moves with the sound; chapters split it, a marker flags one moment, and the transcript follows the voice.

```audio src="media/talk.mp3" title="A page that talks" duration=0:57 wave=bars skip=10 transcript=open
peaks: media/talk.peaks.json
chapter 0:00 Welcome
chapter 0:24 The transcript
chapter 0:38 The marker
marker 0:38 Where the example crashed [bad]
0:00 Ana: Welcome back. Today we look at a page that can talk.
0:04 Ben: A page that talks. Do you mean the audio part?
0:08 Ana: Yes. You write one fence, with a file, a title, and a few lines of transcript.
0:14 Ben: And the reader sees a wave that moves while the voice plays.
0:18 Ana: The wave is drawn from a small peaks file, so it appears before the sound starts.
0:24 Ben: What about people who cannot listen right now?
0:27 Ana: The transcript follows the voice. Tap a line, and the player jumps there.
0:33 Ben: Chapters split the wave into parts, and a marker flags one moment.
0:38 Ana: Here is the marker. This is where the example crashed.
0:42 Ben: And a language model reads the same page as plain text.
0:46 Ana: It gets the title, the chapters, and the transcript, never a picture of a wave.
0:52 Ben: That is the whole part. Press play, and listen again.
```

`wave=mirror` reflects the wave, `wave=dots` draws it in dots, `wave=live` shows a window of the sound that scrolls past "now", and `compact` makes one row. The colour is a word (`tone=c4`), never a hex value.

```audio src="media/talk.mp3" title="Mirror wave, in family colour 4" wave=mirror tone=c4 height=s duration=0:57
peaks: media/talk.peaks.json
```

```audio src="media/talk.mp3" title="Compact" compact wave=line duration=0:57
peaks: media/talk.peaks.json
```

## Calendar

The host supplies no clock here: Today returns to the authored date. Explore the views, switch calendars and open events. A narrow part starts with three days.

```calendar title="Release week" tz=Europe/London date=2026-11-23 view=week hours=08-18
calendar team "Team" [c2]
2026-11-23 09:00-09:20 Stand-up in team every weekday times=5
2026-11-24 10:00-11:30 Design review @ Studio in team note="Bring the mock-ups"
2026-11-24 10:30-11:00 Review notes in team
2026-11-25 all day Code freeze [warn]
2026-11-26 18:00-19:00 Sydney call tz=Australia/Sydney
```

The static form keeps a complete dated list without controls.

```calendar title="Release checklist" tz=Europe/London date=2026-11-23 static
calendar team "Team" [c2]
2026-11-23 09:00-09:20 Stand-up in team every weekday times=3
2026-11-25 all day Code freeze [warn]
```

## Chart kinds

Eight more kinds of a `chart`, each a YAML map with `kind:` at the top: raw values are counted, quartiled or smoothed when the page is built, so a model reads the table. Hover, tap or focus a bin, box, stage, block or day for its card; the arrow keys walk the data.

```chart
kind: histogram
title: How long a request takes
x: { label: latency, format: duration-ms }
y: { label: requests }
bins: 12
marks: [p50, p95]
data: [74, 88, 109, 110, 86, 88, 122, 87, 132, 140, 93, 50, 99, 127, 56, 69, 80, 114, 67, 66, 89, 95, 125, 102, 120, 73, 91, 107, 42, 78, 75, 99, 155, 115, 25, 54, 113, 82, 84, 85, 94, 121, 168, 191]
```

```chart
kind: boxplot
title: Checkout time by day
x: { label: day, values: [Mon, Tue, Wed] }
y: { label: seconds to pay, format: duration }
tone: c4
data:
  - [120, 100, 121, 110, 106, 125, 169, 146, 134, 102, 132, 128, 114, 152]
  - [173, 121, 152, 144, 132, 143, 153, 117, 130, 134, 146, 176, 149, 166]
  - [118, 116, 162, 140, 161, 166, 136, 170, 158, 138, 126, 160, 154, 260]
```

```chart
kind: violin
title: Response time by service
x: { label: service, values: [api, search, checkout] }
y: { label: response, format: duration-ms }
tone: c2
data:
  - [57, 69, 117, 111, 105, 83, 98, 105, 124, 101, 88, 102, 117, 83, 99, 101, 101, 99]
  - [141, 198, 207, 164, 144, 149, 163, 206, 121, 232, 154, 227, 237, 119, 174, 148, 195, 192]
  - [243, 242, 239, 262, 246, 212, 247, 222, 252, 201, 213, 203, 204, 248, 234, 261, 258, 213]
```

```chart
kind: funnel
title: From visit to paid
tone: c1
data:
  - [Visited the site, 48200]
  - [Created an account, 8700]
  - [Started a trial, 4100]
  - [Paid, 1350]
steps:
  - title: Last quarter.
  - title: After the shorter sign-up form.
    data:
      - [Visited the site, 49500]
      - [Created an account, 11300]
      - [Started a trial, 5200]
      - [Paid, 1720]
```

```chart
kind: waterfall
title: Monthly revenue bridge
x: { label: driver, values: [October, New, Churn, Refunds, Subtotal, Price rise, November] }
y: { label: revenue, format: money, currency: EUR }
data: [84000, 12500, -9100, -2300, "=", 4800, "="]
```

```chart
kind: treemap
title: Where the disk went
y: { label: disk use, format: bytes }
data:
  - name: Media
    children:
      - { name: Videos, value: 412000000000 }
      - { name: Photos, value: 186000000000 }
  - name: Code
    children:
      - { name: Repos, value: 86000000000 }
      - { name: Build cache, value: 88000000000 }
  - { name: Backups, value: 140000000000 }
```

```chart
kind: sunburst
title: Lines of code by team and area (thousands)
y: { label: lines of code }
data:
  - name: Platform
    children:
      - { name: Runtime, value: 93 }
      - { name: Storage, value: 66 }
  - name: Product
    children:
      - { name: Web, value: 95 }
      - { name: Mobile, value: 69 }
  - { name: Docs, value: 18 }
```

```chart
kind: calendar
title: Commits, September to November
y: { label: commits }
tone: good
from: 2026-09-01
to: 2026-11-30
data: [["2026-09-01", 7], ["2026-09-02", 6], ["2026-09-03", 5], ["2026-09-07", 4], ["2026-09-09", 2], ["2026-09-12", 2], ["2026-09-14", 4], ["2026-09-15", 10], ["2026-09-16", 1], ["2026-09-17", 3], ["2026-09-18", 5], ["2026-09-21", 8], ["2026-09-23", 9], ["2026-09-24", 5], ["2026-09-25", 3], ["2026-09-26", 2], ["2026-09-27", 1], ["2026-09-28", 9], ["2026-09-29", 8], ["2026-09-30", 7], ["2026-10-01", 8], ["2026-10-02", 9], ["2026-10-04", 1], ["2026-10-05", 5], ["2026-10-06", 9], ["2026-10-11", 2], ["2026-10-12", 9], ["2026-10-13", 9], ["2026-10-15", 5], ["2026-10-16", 6], ["2026-10-17", 1], ["2026-10-18", 1], ["2026-10-20", 8], ["2026-10-21", 3], ["2026-10-22", 6], ["2026-10-23", 6], ["2026-10-24", 1], ["2026-10-25", 1], ["2026-10-26", 2], ["2026-10-29", 7], ["2026-10-30", 7], ["2026-10-31", 1], ["2026-11-01", 0], ["2026-11-04", 4], ["2026-11-06", 5], ["2026-11-07", 0], ["2026-11-08", 0], ["2026-11-09", 2], ["2026-11-11", 2], ["2026-11-12", 6], ["2026-11-13", 8], ["2026-11-14", 2], ["2026-11-15", 0], ["2026-11-16", 8], ["2026-11-17", 6], ["2026-11-18", 3], ["2026-11-19", 1], ["2026-11-21", 2], ["2026-11-22", 2], ["2026-11-23", 3], ["2026-11-24", 8], ["2026-11-26", 7], ["2026-11-27", 10], ["2026-11-28", 0], ["2026-11-29", 1], ["2026-11-30", 7]]
```

Each kind takes `title`, `tone` where it makes sense, `y: { label, format, currency }` for the value axis (the histogram's is `x`), and `steps:` that change `data`, `marks` or `bins` from one step to the next.

## Compare

**A comparison matrix puts options side by side, one line for each thing you judge them on.** The first line names the options; every other line is a criterion and one value for each option, in the same order. A note in round brackets shows when a reader hovers, focuses or taps the value. With `winner=on` the best value of each yes/no, scored or good/bad row is marked; `pick=` flags the option you recommend.

```compare title="Which queue?" winner=on pick=Kafka
options: Redis Streams [c1], Kafka [c2], SQS [c3]
Ordering: yes, yes, partial (FIFO queues only)
Runs itself: no, no, yes
Throughput: 3, 5, 3 (score 1-5)
Latency (lower is better): 4 ms (in one region), 12 ms, 25 ms
Replay old messages: yes (until trimmed), yes (by offset), no
Cost at our size: good, bad, good (pay per request)
Team knows it: yes, partial (two people), yes
```

With `view=single`, a phone shows one option at a time, chosen from buttons. Here the values are plain words and good, warn and bad, so no row is marked as the best.

```compare title="Where to host the docs" view=single
options: Own servers, Static host, Wiki service
Set-up time: a week, an hour, a day
Custom domain: good, good, warn (paid plan only)
Search: warn (add one), warn (add one), good
Who can edit: developers, developers, anyone with an account
```

## Compare image

**A before-and-after picture lays two images of the same size on top of each other, with a bar between them.** Drag the bar (or anywhere on the picture), press the arrow keys, or tap the picture to flip from one to the other; the two labels jump to a whole image. Each image line gives the address and the alt text in quotes, which is what a screen reader and an LLM read. The address goes through the host's URL policy (a relative path, http or https; never `data:`). The two sample images are the files `before-light.svg` and `after-dark.svg` in this part's `media/` folder: a host serves that folder as `media/`.

```compare-image title="A dashboard, light and dark" before="Light" after="Dark"
before: media/before-light.svg "A dashboard with four tiles and a bar chart on a light page"
after: media/after-dark.svg "The same dashboard on a dark page"
```

## Diff

A `diff` block holds what `git diff` prints. It is drawn as a diff view: a file header with how much changed, line numbers on both sides, the changed words marked inside a changed line, and long unchanged runs folded. It is split on a wide part and unified on a narrow one; the buttons switch it, and `view=split` or `view=unified` fixes it. On a phone the lines do not wrap: the numbers and the sign stay in view while the code scrolls inside its box.

```diff
diff --git a/src/server.ts b/src/server.ts
index 4b825dc..9f3c1a7 100644
--- a/src/server.ts
+++ b/src/server.ts
@@ -12,9 +12,10 @@ export function start(config: Config) {
   const port = config.port ?? 8080;
-  const host = "localhost";
+  const host = config.host ?? "0.0.0.0";
   const server = createServer(handler);
-  server.listen(port, host);
+  server.listen(port, host, () => log.info("listening", { port, host }));
   register(server);
   watch(config);
   return server;
@@ -48,6 +49,6 @@ export function stop(server: Server) {
   unwatch();
-  server.close();
+  server.close(() => log.info("closed"));
 }
@@ -80,18 +81,19 @@ export function reload(server: Server) {
   const next = readConfig();
-  if (next.port !== current.port) restart(server);
+  if (next.port !== current.port || next.host !== current.host) restart(server);
   current = next;
   emit("reload", next);
   mark("reload");
   audit(next);
   notify(next);
   flush();
   settle();
   prune();
   index();
   compact();
   verify();
+  log.debug("reloaded", { port: next.port });
   return server;
 }
```

With `static` the diff is drawn whole, with no button: every file open, and a folded run only says how many lines it holds.

```diff static
--- a/src/greet.ts
+++ b/src/greet.ts
@@ -1,4 +1,4 @@
 export function greet(name: string) {
-  return "Hello, " + name;
+  return `Hello, ${name}!`;
 }
```

## Downloads

A card for each file: a type icon, its size, a plain download link, and a checksum that copies on a tap, with the line that checks it. Nothing is counted and nothing is fetched until the reader presses Download.

```downloads title="Files for this page"
media/report.pdf "The report, first pages" 209 KB sha256=d14bdfa9e9a37c960e8a2835fd6c0e75aa6e201e1e967d18159378e3de124372
media/talk.mp3 "The spoken sample" 229 KB sha256=8ed40d5dc963c74c457b987f9af4b4f3a33f1c13aa7a547cd3e959bf6fcd5d55
media/build.json "The hand-written animation" 6.4 KB note="A Lottie file with no expressions and no images."
https://example.com/durian-markdown-0.7.0.tar.gz "Source archive (an example address)" 1.2 MB sha256=2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae note="The address is an example; nothing is fetched until you press Download."
media/requests.csv "Raw data" 15.4 KB note="One row per request."
```

## Explore

A fence in the data's own language, followed by `explore`, becomes a foldable tree with a search box, a copy-path button on every key and a **jq subset** query box. It reads JSON, YAML or CSV (a CSV's rows become objects). `query=` is the starting query. The box runs our own small jq (the "jq subset": paths, pipes, `select`, `map`, `keys`, `length`, `sort_by`, `group_by`, `to_entries`, `test`, string interpolation, building objects and arrays); a query that needs more work than a page may use says so, and a function outside the subset is named, never answered wrongly. It lacks assignment (`|=`), `reduce`, `foreach`, `def`, `paths`, `del`, `sub`, `gsub`, `match` and `walk`.

```json explore title="One order" query=".lines[] | select(.qty > 1)"
{
  "id": "o-7",
  "customer": { "id": "c-12", "name": "Ana", "tags": ["vip", "early"] },
  "lines": [
    { "sku": "tea", "qty": 2, "price": 3.5 },
    { "sku": "cup", "qty": 1, "price": 8 },
    { "sku": "pot", "qty": 3, "price": 12.25 }
  ],
  "paid": true,
  "note": null
}
```

The same reader takes YAML and CSV. TOML exploration is refused until a TOML reader is available; the TOML example below is ordinary code:

```yaml explore title="A service config" query=".limits | map_values(ascii_upcase)"
service: shop
replicas: 3
limits:
  cpu: 500m
  mem: 256Mi
hosts:
  - name: app-1.example.com
    zone: a
  - name: app-2.example.com
    zone: b
```

```toml
[server]
host = "198.51.100.7"
port = 8443
tls = true

[limits]
cpu = "500m"
```

```csv explore title="Latency by region" query="sort_by(.p95) | reverse | .[0].region"
region,p50,p95,requests
us-west,42,120,1200000
eu-central,55,180,830000
ap-south,70,260,410000
```

## Fishbone

Causes by category along a spine into the effect. In a narrow column the spine turns vertical.

```fishbone title="Why is checkout slow?"
effect: Checkout takes 4 seconds at p95
People: on-call is new to the service
Process: no load test before a release
  only staging has real data
Tools: the ORM loads every line item
  one query per line
Environment: the database is in another region
```

With steps, the bones come in one at a time, and `highlight` lights one.

```fishbone title="Why did the deploy fail?"
effect: The deploy rolled back
@step The first two causes.
Config: a key was renamed in one place only
Tests: the contract test was skipped
@step The third, and the one to fix first.
Release: two services shipped in the wrong order
highlight Config
```

## Flame chart and flame graph

A traced request and folded profiler stacks. Tap a frame to zoom; search highlights matching frames.

```flame title="One request, traced" unit=ms
0 120 request
  2 14 auth.check
  15 95 handler.order
    16 70 db.query
    72 90 render.page
  96 118 respond.write
```

```flame title="CPU, 30 seconds" unit=samples colour=heat
main;serve;handle;parse 120
main;serve;handle;db.query 300
main;serve;handle;db.query;lock.wait 80
main;serve;handle;render.page 95
main;serve;gc 45
main;serve;accept 30
main;housekeeping;flush 60
```

## Gallery

A carousel shows one image at a time: swipe, use the arrow keys, the buttons or the dots. A tap opens the picture full screen, where pinch, wheel and double tap zoom it, and one finger or the mouse pans.

```gallery title="Four sample pictures" view=carousel loop
![A harbour at dawn: a low sun over a still sea](media/harbour.svg "Harbour at dawn: a made-up picture for the sample")
![A pine forest in green light](media/forest.svg "Pine forest")
![Sand dunes under a pale sky](media/dunes.svg "Dunes at noon")
![A mountain behind a lake](media/lake.svg "Mountain lake")
```

A grid crops to a ratio (the full picture stays in the lightbox), with the caption under each image.

```gallery title="The same pictures, as a grid" view=grid columns=3 ratio=4:3
![A harbour at dawn](media/harbour.svg "Harbour")
![A pine forest](media/forest.svg "Forest")
![Sand dunes](media/dunes.svg "Dunes")
![A mountain lake](media/lake.svg "Lake")
```

One image, with zoom.

```gallery view=single
![A mountain behind a lake](media/lake.svg "Tap the picture to see it full screen")
```

## Gantt

A task line is `<id> "label" <start> <end or length> [progress%] [done] [colour]`; a start is a date or `after <id> ...`; `milestone` is a point; `section` groups the lines after it. `today=` draws a line (never the real clock). Hover, tap or focus a bar for its dates and what it waits for; Day, Week and Month change the scale.

```gantt title="Release 2.0" today=2026-12-09
section Build
design "Design" 2026-12-01 .. 2026-12-04 done
api "API" after design 8d 60%
ui "Screens" after design 6d
section Ship
beta "Beta" after api ui 3d [warn]
launch "Launch" milestone after beta
```

Under steps, `progress`, `done` and `move` change the plan as time passes; a slip carries the tasks after it. `workdays=on` makes lengths skip Saturday and Sunday, and `critical=on` outlines the longest chain.

```gantt title="A release that slips" workdays=on critical=on today=2026-12-14
section Build
design "Design" 2026-12-01 .. 2026-12-04 done
api "API" after design 8d 40%
ui "Screens" after design 6d
section Test
qa "QA" after api ui 5d
@step The plan on 1 December
@step Design is done, the API is under way
progress api 60%
progress ui 100%
@step The API slips by a week
move api 2026-12-14
launch "Launch" milestone after qa
```

## Glossary

Terms defined once. Where a term is used in the text, its first use in each section is a button with a dotted underline: hover it, tap it, or focus it and press Enter to read the meaning.

```glossary title="Words we use"
term "UL" also "ubiquitous language": the words a team agrees on and uses in code and in talk
term bc "bounded context" also "context map": one part of the system with its own **words**; see [the book](https://example.com/ddd)
```

Each team keeps its own UL inside a bounded context. The second use of UL in the same section stays plain text: UL.

## Graph

A graph is for finding your way around a big network: what uses what, and what breaks if one part goes. Write `group` and `node` lines, then one edge a line (`a -> b`, with a label in quotes if it needs one). A node an edge names and no line declares is added (here the outside libraries). `layout=layers` puts each package above what it uses. **Explore it:** search a package, tap one to focus it and its neighbours (1 or 2 steps out), fold a group into one box, pan and zoom; the list beside the graph shows its links in and out. A graph this size reads as over 400 tokens, so the `:::llm` after it says the same in short.

```graph title="A shop's packages, and what each one uses" layout=layers
group apps "apps" [c1]
group ui "user interface" [c4]
group domain "domain" [c2]
group data "data access" [c6]
group core "core" [c3]
group tools "build and test" [muted]
node web "web shop" in apps
node admin "admin console" in apps
node worker "background worker" in apps
node cli "command line" in apps
node ui-kit, charts, forms, icons, theme in ui
node cart, checkout, catalog, accounts, search, pricing, orders, money, auth in domain
node db, cache, queue, events, http-client, storage in data
node config, log, errors, util, i18n, time in core
node build, lint, test-kit in tools
web -> ui-kit, forms, cart, checkout, catalog, search, accounts, i18n
admin -> ui-kit, charts, forms, orders, catalog, accounts
worker -> orders, events, queue, log
cli -> config, catalog, db
ui-kit -> theme, icons, react
charts -> ui-kit, chart.js "lazy"
forms -> ui-kit, zod
cart -> pricing, catalog, cache
checkout -> cart, orders, money, auth
catalog -> db, search, storage
accounts -> auth, db, events
search -> http-client, cache
pricing -> money, catalog
orders -> db, money, events, queue
money -> util
auth -> db, cache, errors
db -> pg, config, log, errors
cache -> ioredis, config
queue -> ioredis, events
events -> log, time
http-client -> undici, errors
storage -> http-client, config
config -> zod, util
log -> time, util
errors -> util
i18n -> date-fns, util
time -> date-fns
test-kit -> db, cache, config "fakes"
build, lint -> config
```

:::llm
A layered package graph of a shop: 33 packages in 6 groups, plus 7 outside libraries (react, chart.js, zod, pg, ioredis, undici, date-fns); 80 edges. The apps (web shop, admin console, background worker, command line) use the user interface packages (ui-kit, charts, forms, icons, theme) and the domain packages (cart, checkout, catalog, accounts, search, pricing, orders, money, auth). The domain uses data access (db, cache, queue, events, http-client, storage), which uses core (config, log, errors, util, i18n, time). Checkout needs cart, orders, money and auth; auth needs db, cache and errors. Most connected: db (6 in, 4 out), config (7 in, 2 out), web (8 out), catalog (5 in, 3 out).
:::

`layout=force` pulls linked services together and pushes the rest apart, so the clusters show. It fits calls between services, where there is no top or bottom. An id may carry a numbered range: `node db-orders-{1..6} in data` declares six shards, and `orders -> db-orders-{1..6}` draws a line to each. **Fold a group** (beside the graph, or a double tap on its box) and its lines join on one box with a count; **Fold groups** folds them all. A graph over 300 nodes, or one that would be drawn too small to touch in its box (a phone), starts with every group folded. Its LLM view is the nodes by group, the edges as `a -> b` lines, and the most connected nodes: here far over 400 tokens, so a `:::llm` says it in short.

```graph title="Calls between the services of a shop" layout=force size=l
group edge "edge" [c1]
group identity "identity" [c2]
group catalog "catalog" [c3]
group orders "orders" [c4]
group payments "payments" [c5]
group fulfil "fulfilment" [c6]
group data "data stores" [c8]
group platform "platform" [c7]
node cdn, waf, gateway, web-bff, mobile-bff, admin-bff, graphql, rate-limit, bot-check, geo-route, edge-cache, ws-hub, upload-proxy, img-proxy, status-page in edge
node auth, sessions, users, profiles, roles, mfa, sso, tokens, consent, audit, password-reset, email-verify, devices, risk-score, api-keys in identity
node catalog-api, products, variants, inventory, prices, promos, reviews, search-api, indexer, recs, media, categories, brands, bundles, wishlist in catalog
node cart-api, checkout, orders-api, order-events, invoices, returns, refunds, tax, shipping-quote, gift-cards, loyalty, quotes, subscriptions, order-history, fraud in orders
node pay-api, card-vault, psp-a, psp-b, wallets, payouts, ledger, fx, disputes, settlements, pay-events, three-ds, chargebacks, billing, receipts in payments
node fulfil-api, warehouses, picking, packing, carriers, labels, tracking, dispatch, slots, couriers, stock-sync, returns-in, notify, sms, email in fulfil
node db-orders-{1..6}, db-users, db-catalog, cache-{1..3}, search-index, blob-store, event-bus, dw in data
node config-svc, flags, secrets, metrics, logs, traces, scheduler, jobs, alerts, ci, registry, mesh, dns, kms, backups in platform
cdn -> edge-cache, img-proxy, waf
waf -> gateway, bot-check, rate-limit
gateway -> web-bff, mobile-bff, admin-bff, graphql, ws-hub, upload-proxy, geo-route
web-bff -> auth, sessions, catalog-api, cart-api, search-api, recs, checkout
mobile-bff -> auth, sessions, catalog-api, cart-api, search-api, wishlist, checkout
admin-bff -> auth, roles, catalog-api, orders-api, refunds, users, audit
graphql -> catalog-api, orders-api, profiles, reviews
ws-hub -> tracking, order-events, sessions
upload-proxy -> media, blob-store
img-proxy -> media
status-page -> metrics, alerts
auth -> sessions, users, mfa, sso, tokens, risk-score, devices
sessions -> cache-1, tokens
users -> db-users, profiles, email-verify, audit
profiles -> db-users, media, consent
roles -> db-users, audit
mfa -> sms, email, devices
sso -> tokens, users
tokens -> kms, cache-1
password-reset -> email, tokens, users
email-verify -> email
api-keys -> tokens, db-users
risk-score -> devices, fraud
catalog-api -> products, categories, brands, prices, inventory, media, bundles
products -> variants, db-catalog, cache-2
variants -> db-catalog
inventory -> db-catalog, stock-sync, event-bus
prices -> promos, fx, cache-2
promos -> db-catalog
reviews -> db-catalog, users
search-api -> search-index, recs
indexer -> search-index, event-bus, products
recs -> dw, cache-2
wishlist -> db-users, products
cart-api -> products, prices, promos, cache-3, gift-cards
checkout -> cart-api, tax, shipping-quote, pay-api, orders-api, fraud, loyalty
orders-api -> db-orders-{1..6}, order-events, invoices
order-events -> event-bus
invoices -> tax, receipts, blob-store
returns -> orders-api, returns-in, refunds
refunds -> pay-api, ledger
tax -> fx
shipping-quote -> carriers, slots
gift-cards -> ledger
loyalty -> users, ledger
quotes -> prices, tax
subscriptions -> billing, orders-api, scheduler
order-history -> db-orders-{1..6}, dw
fraud -> risk-score, dw
pay-api -> card-vault, psp-a, psp-b, wallets, three-ds, ledger, pay-events
card-vault -> kms, secrets
psp-a, psp-b -> pay-events
wallets -> ledger
payouts -> ledger, psp-a, settlements
ledger -> fx, dw
disputes -> chargebacks, psp-a, psp-b
settlements -> ledger, dw
pay-events -> event-bus
chargebacks -> ledger
billing -> pay-api, receipts
receipts -> email, blob-store
fulfil-api -> warehouses, dispatch, labels, tracking
warehouses -> stock-sync, picking
picking -> packing
packing -> labels
labels -> carriers, blob-store
carriers -> tracking
tracking -> notify, event-bus
dispatch -> couriers, slots, carriers
stock-sync -> inventory, event-bus
returns-in -> warehouses, refunds
notify -> sms, email
event-bus -> fulfil-api, indexer, notify, dw, audit
scheduler -> jobs
jobs -> backups, indexer, payouts, settlements
alerts -> metrics, logs
mesh -> dns, traces, metrics
backups -> blob-store
ci -> registry
config-svc -> flags, secrets
secrets -> kms
gateway, auth, checkout, pay-api, orders-api -> mesh
```

:::llm
A force-laid call graph of a shop: 120 services in 8 groups, 232 calls. Edge (cdn, waf, gateway, three backends for web, mobile and admin, graphql, ws-hub ...) calls identity (auth, sessions, users, tokens, mfa, sso ...) and catalog (catalog-api, products, prices, search-api, recs ...). Checkout calls cart-api, tax, shipping-quote, fraud, loyalty, pay-api and orders-api; orders-api writes six shards, db-orders-1 to db-orders-6. pay-api calls card-vault, two payment providers, wallets, three-ds and the ledger. Events go through event-bus to fulfilment (warehouses, picking, packing, labels, carriers, tracking), the indexer, notify, the warehouse (dw) and audit. Platform: config, flags, secrets, kms, metrics, logs, traces, the mesh, scheduler and jobs. Most connected: orders-api (5 in, 9 out), auth, catalog-api, pay-api, event-bus (6 in, 5 out).
:::

`layout=radial centre=<node>` puts one node in the middle and each ring one step further away, in either direction: what it uses and what uses it. Use it to answer "what touches this?". A small graph needs no `:::llm`: its LLM view is the graph itself, as lines.

```graph title="What touches the sign-in service" layout=radial centre=auth
group callers "calls sign-in" [c1]
group needs "sign-in calls" [c6]
node web, mobile, admin, cli in callers
node sessions, users, mfa, tokens in needs
node auth "sign-in"
web, mobile, admin, cli -> auth
auth -> sessions, users, mfa, tokens
mfa -> sms "codes"
tokens -> kms "signing keys"
sessions, users -> postgres
```

`static` draws the part still: the groups with how many nodes each holds, and a line that counts the edges between two groups. It is for print, a PDF, an email, or a reader who asks for less motion.

```graph title="The same sign-in graph, drawn still" layout=radial centre=auth static
group callers "calls sign-in" [c1]
group needs "sign-in calls" [c6]
node web, mobile, admin, cli in callers
node sessions, users, mfa, tokens in needs
node auth "sign-in"
web, mobile, admin, cli -> auth
auth -> sessions, users, mfa, tokens
mfa -> sms "codes"
tokens -> kms "signing keys"
sessions, users -> postgres
```

## Http

An `http` block is a request and, after a blank line, its response, as text. It is drawn as a method tag and the address (the query split into names and values), the headers (folded after six), the body (JSON is pretty and can be folded), the status as a tag coloured by its class, and a button that copies the request as `curl`. A secret in a header is never written out: use a placeholder such as `<token>`.

```http title="Create an order"
POST /v1/orders?dry_run=false&currency=usd HTTP/1.1
Host: api.example.com
Content-Type: application/json
Accept: application/json
Authorization: Bearer <token>
Idempotency-Key: 6f1c2d0e
User-Agent: shop-cli/2.4
X-Request-Id: req-7a91

{ "sku": "tea", "qty": 2, "ship": { "to": "198.51.100.7", "express": true }, "notes": ["gift", "no receipt"] }

HTTP/1.1 201 Created
Content-Type: application/json
Location: /v1/orders/o-7

{ "id": "o-7", "status": "open", "total": { "amount": 1840, "currency": "usd" } }
```

With `static` the whole message is drawn: every header, the whole JSON tree, no button.

```http static
HTTP/1.1 404 Not Found
Content-Type: application/json
Cache-Control: no-store

{ "error": "not_found", "detail": { "resource": "order", "id": "o-9" } }
```

## Log

A fence named `log`. It reads JSON lines, logfmt and the common "time level message key=value" shape. The filter box speaks **LogQL** (Grafana Loki's query language): `{level="error"}`, `|= "timeout"`, `!= "health"`, `|~ "5\\d\\d"`, `| status >= 500`; a box that starts with neither `{` nor `|` is plain words. Only the query half of LogQL is read, never metric queries. `filter=` is the starting filter. The author (often an agent) points at what matters with `@highlight` lines: a LogQL filter or `line 3-5`, a colour word and the reason in quotes.

```log title="The failed deploy" labels="app=shop, env=prod" filter="{level=~\"warn|error\"}"
2026-11-20T10:08:01Z info  deploy started version=1.4
2026-11-20T10:08:12Z info  migration applied name=0042
2026-11-20T10:09:03Z warn  cache miss rate high rate=0.41
2026-11-20T10:09:05Z error request failed path=/cart status=500 err="timeout after 30s" span=checkout trace=request
2026-11-20T10:09:06Z error request failed path=/cart status=500 err="timeout after 30s" span=checkout trace=request
@highlight |= "timeout" [bad] "every failure is the same timeout"
@highlight line 3 [warn] "the first sign"
```

## Lottie

A Lottie file is a drawing that moves. This one was written by hand for the sample: a box fills with blocks, one row at a time, then a tick appears. It plays while it is on screen, stops off it, and shows one still frame when the reader asks for less motion. The `colours:` line maps names inside the file to theme colours, so it follows light and dark.

```lottie src="media/build.json" title="What happens while it builds" loop
alt: A box fills with blocks, one row at a time, then a tick appears.
colours: dh-c1 = c1, dh-c2 = c2, dh-c3 = c3, dh-good = good
```

## Map and routes

Places and written routes work without a tile provider. A dashed route has no road geometry; the host may supply its own router.

```map title="Walk to the garden"
place start "Library" 51.507, -0.128 [c1] note="Meet by the entrance"
place garden "Garden" 51.511, -0.117 [c2]
route walk "Morning walk" by=walk [c2]: start -> 51.508, -0.123 -> garden
@step Meet at the library.
focus start
@step Follow the written route.
show walk
focus walk
```

Country values, US states and flows share the same map and value list.

```map title="Daily flow" unit="units per day" scale=steps steps=4
fill DE 83.2
fill FR 68.4
fill US-CA 39.5
arc DE -> FR 24 "Daily flow" [c2]
```

The globe uses the same data; with no WebGL it falls back to the flat map.

```map title="Global flow" view=globe spin=off unit="units per day"
fill DE 83.2
fill FR 68.4
arc DE -> FR 24 "Daily flow" [c2]
```

A static globe is a flat map with all its values, ready to print.

```map title="A still map" view=globe static
fill DE 83.2
fill FR 68.4
```

## Maths (`$...$`, `$$...$$` and `math`)

The area of a circle is $A = \pi r^2$, and a sum of the first $n$ numbers is:

$$
\sum_{k=1}^{n} k = \frac{n(n+1)}{2}
$$

The same in a `math` block, with a fraction, a root and a matrix:

```math
x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a} \qquad
\begin{pmatrix} 1 & 0 \\ 0 & 1 \end{pmatrix}
```

Prices stay text: it costs $5 and $10, and `$not maths$` in code is left alone.

## PDF

pdf.js draws the pages on a canvas, and its text layer makes the words selectable and searchable. The file below was printed from a small made-up document. The viewer works a page at a time; try the search box, the outline and the zoom.

```pdf src="media/sample.pdf" title="A sample document" page=1 height=l
```

`view=scroll` lays every page out in one scrolling column and draws the ones near the window.

```pdf src="media/sample.pdf" title="The same file, scrolling" view=scroll height=s
```

## Citations (`[@key]` and `references`)

A mark in the text opens its entry: marks make a study easier to read [@smith2020, p. 12], and two together are one group [@smith2020; @lee2019]. Hover, focus or tap a mark for the entry.

```references style=apa title="References"
- id: smith2020
  author: Smith, Jane; Lee, Kim
  title: A study of marks
  in: Journal of Studies
  year: 2020
  volume: 12
  issue: 3
  pages: 10-20
  doi: 10.1234/jbs.2020.4
- id: lee2019
  author: Lee, Kim
  title: Notes on lists
  type: web
  publisher: Example Press
  year: 2019
  url: https://example.com/notes
  accessed: 2026-11-20
```

## Sankey

A flow a line, `from -> to: amount`; `node <id> "label" [colour]` only to name or colour one. Hover, tap or focus a band to light its path and read its share.

```sankey title="Where a request's time goes" unit=ms
request -> auth: 12
request -> handler: 80
handler -> db: 55
handler -> render: 20
handler -> cache: 5
node db "Postgres" [c3]
node cache "Redis" [c2]
```

Flows under a step appear in it: the bands grow out of their source. In a narrow column, a sankey with more than three columns runs top to bottom.

```sankey title="Where the month's budget goes" unit=USD
income -> payroll: 62000
income -> infra: 21000
income -> tools: 6000
income -> reserve: 11000
@step The money in and the big three
@step Infrastructure breaks down
infra -> compute: 12500
infra -> storage: 5200
infra -> network: 3300
@step Compute splits by team
compute -> web: 7000
compute -> data: 4100
compute -> ml: 1400
node income "Revenue" [c1]
node payroll "People" [c4]
node infra "Infrastructure" [c6]
```

## Sequence

Who calls whom, in order. A call is a solid arrow, a reply a dashed one; a block (`loop`, `alt`, `opt`, `par`) frames the messages inside it. An LLM reads the messages as a numbered list.

```sequence title="One init call"
actor dev "developer"
participant cli "CLI"
participant tc "template container"
dev -> cli: scaffold create
cli -> tc: init call, all answers
tc --> cli: question reply
note tc: the script stopped at a question
loop until no question is left
  cli -> tc: init call, one more answer
  tc --> cli: question reply
end
cli --> dev: project written
```

With `@step` lines the story builds up one call a step: the earlier calls fade and the new one draws itself.

```sequence
participant cli "CLI"
participant tc "template container"
@step The CLI sends an init call with every answer it holds.
cli -> tc: init call: all answers
@step The script stops at a question and sends it back.
tc --> cli: question reply
@step The next init call carries one answer more.
cli -> tc: init call: one more answer
```

## Sparkline in a sentence (`:spark[...]`)

`:spark[3,5,2,8,9]` draws a tiny line the height of the text. Add `bar` for bars and a colour word for the colour: `:spark[3,5,2,8,9 bar good]`. Hover, tap or focus it to see the numbers. A model reads `(3, 5, 2, 8, 9)`.

Sign-ups this week were :spark[120,135,128,160,182,171,205] and rising, errors fell to :spark[14,12,15,9,7,4,3 bar good], and the queue is :spark[5,4,6,22,31,18,9 warn] after Wednesday's spike.

## Stacktrace

A fence named `stacktrace`. It reads a trace as printed by Go, .NET, Bun or Node, Dart, Java or Python: the error line, each cause in its own block, threads as groups. Library frames fold into one bar; frames of your own code (`app=`) are marked, and with `repo=` and `strip=` they name the file and line at the page’s pinned commit (when its front matter has a matching pins entry). Tap a frame to open it.

```stacktrace lang=go app=example.com/shop repo=example.com/shop strip=/src/shop/ title="A Go panic"
panic: runtime error: index out of range [3] with length 3

goroutine 18 [running]:
example.com/shop/cart.(*Cart).Item(...)
	/src/shop/cart/cart.go:42
example.com/shop/api.(*Server).getItem(0xc0001a2000, {0x7f1c, 0xc000124000}, 0xc000188000)
	/src/shop/api/items.go:88 +0x1d4
net/http.HandlerFunc.ServeHTTP(0xc000010040, {0x7f1c, 0xc000124000}, 0xc000188000)
	/usr/local/go/src/net/http/server.go:2136 +0x29
net/http.serverHandler.ServeHTTP({0xc00011e000}, {0x7f1c, 0xc000124000}, 0xc000188000)
	/usr/local/go/src/net/http/server.go:2938 +0x8e
```

## Stack traces in the other five languages

`lang=` may be left out when the trace says it. Each trace below is read by its own parser.

```stacktrace app=Acme.Shop title=".NET, with an inner exception"
System.InvalidOperationException: Cart failed
 ---> System.ArgumentException: Index out of range (Parameter 'i')
   at Acme.Shop.Cart.Item(Int32 i) in /src/shop/Cart.cs:line 42
   at System.Linq.Enumerable.First[TSource](IEnumerable`1 source)
   --- End of inner exception stack trace ---
   at Acme.Shop.Api.GetItem(Int32 id) in /src/shop/Api.cs:line 88
   at Microsoft.AspNetCore.Mvc.Invoke()
```

```stacktrace app=/src/shop title="Bun or Node, with a cause"
Error: request failed
    at fetchItem (file:///src/shop/api.ts:42:11)
    at async handler (/src/shop/server.ts:10:3)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at run (/src/shop/node_modules/lib/index.js:5:9)
Caused by: TypeError: bad json
    at parse (/src/shop/util.ts:7:2)
```

```stacktrace app=shop title="Dart, with an async gap"
Unhandled exception:
Bad state: no element
#0      Cart.item (package:shop/cart.dart:42:7)
#1      Api.get (package:shop/api.dart:10:3)
<asynchronous suspension>
#2      _rootRunUnary (dart:async/zone.dart:1407:47)
#3      State.setState (package:flutter/src/widgets/framework.dart:1100:9)
```

```stacktrace app=com.acme.shop title="Java, with Caused by"
java.lang.IllegalStateException: cart failed
	at com.acme.shop.Cart.item(Cart.java:42)
	at com.acme.shop.Api.get(Api.java:88)
	at java.base/java.util.ArrayList.get(ArrayList.java:427)
	... 12 more
Caused by: java.io.IOException: boom
	at com.acme.shop.Db.read(Db.java:7)
	... 5 common frames omitted
```

```stacktrace app=/src/app title="Python, chained"
Traceback (most recent call last):
  File "/src/app/db.py", line 5, in read
    raise OSError("boom")
OSError: boom

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/src/app/main.py", line 10, in <module>
    run()
  File "/usr/lib/python3.11/site-packages/x.py", line 5, in run
    raise ValueError("bad")
ValueError: bad
```

## Stats

**Stat tiles are the row of big numbers at the top of a dashboard:** each tile is one figure with its name, how it changed and, if given, a tiny line of its recent values, so a reader takes in the state of something at a glance before reading on. The colour word in brackets says whether the change is good or bad (a fall in latency is good); it is never guessed from the sign.

```stats title="The week"
Requests "1.2 M" change=+12% [good] note="last 7 days" spark=3 5 4 6 8 9
p95 latency "180 ms" change=-8% [good] spark=9 8 8 7 7 6 5
Errors "0.4%" change=+0.1 [bad] note="of requests" spark=2 2 3 2 4 5
Cost "USD 412" change=+3% spark=4 4 5 5 5 6
```

A tile can also carry a glyph, a trend word and a sub-line. This block is `static`: it draws the tiles whole, the same in print.

```stats title="Garden at a glance" static
Yield "251 kg" glyph="✦" trend=up sub="Across three plots" change=+8% [good] note="this season" spark=180 192 205 224 251
Water "120 L" glyph="◉" trend=down sub="Stored rainwater" change=-6% [good] note="this week" spark=150 145 138 126 120
Beds "30" glyph="▦" trend=flat sub="Ready for planting" [c3]
```

## Timeline

One line per event, oldest first; an indented line is a detail. A year, a month or a day.

```timeline title="A release plan"
2026-05-04 Design review [c1]
  Scope and owners agreed
2026-09 First release [c2]
2026-11-21 Old drawing code removed [c5]
  New drawn parts take their place
2026-11-23 Version 2 ships [good] note="the big one"
```

With `dir=across` a wide screen lays it out sideways; a phone is always top to bottom. With steps, the events come in one group at a time.

```timeline title="A build-up" dir=across
2026 The idea
@step The first half of the year.
2026-03 A prototype
2026-06 A first user
@step The second half.
2026-09 First release [c2]
2026-12 Version 2 [good]
```

## Trace waterfall

A request across services. Fold spans, search, zoom the mini map, or switch to Flame.

```trace title="POST /checkout" unit=ms trace=t-7f3a
web        POST /checkout        0 842  user=u7 region=us-west-2
  gateway  route /checkout       3 838  route=checkout
    auth   verify.token          6  44  method=jwt
      db   SELECT sessions      10  38  rows=1
    cart   cart.load            47 205  items=3
      db   SELECT cart_items    52 121  rows=3
      db   SELECT prices       126 198  rows=3 cache=miss
    inventory stock.reserve     50 171  warehouse=w2
      db   UPDATE stock         57 166  rows=1 id=stock-update
    payment charge.card        208 812  provider=examplepay error="payment provider timed out"
      payment tls.connect      212 255
      payment provider.call    258 804  attempt=1 id=provider error="upstream timeout after 540 ms"
    queue  publish.retry       814 834  topic=payments.retry id=retry
@log db 130 warn "row lock held 94 ms" span=stock-update
@log payment 258 info "calling examplepay /v2/charge"
@log payment 804 error "upstream timeout after 540 ms, giving up"
@log queue 820 info "queued a retry for order o-2291"
@log web 840 error "answered 504 to the client"
@service db [c5] "Postgres"
```

:::llm
One checkout request, 842 ms, across 8 services. The payment provider call (258–804 ms) timed out, so charge.card and the request failed with a 504, and a retry was queued. Stock was reserved in parallel with the cart load and is not on the critical path; UPDATE stock in db waited 94 ms on a row lock.
:::

```trace title="GET /health" unit=ms open=2
web   GET /health        0 9
  api health.check       1 8
    db SELECT 1          2 6
```

```trace title="A flat list" unit=ms critical=off
web   GET /orders     0 60   id=a
api   orders.list     3 55   id=b parent=a
db    SELECT orders   8 40   id=c parent=b rows=25
api   orders.render  41 54   id=d parent=b
```

## Venn

Two to four sets in fixed, even shapes. It is not drawn to scale on purpose: the names are written in the regions. Hover, tap or focus a region to read its items; on a narrow screen they are listed under the figure.

```venn title="Who writes what"
set go "Go" [c1]
set rust "Rust" [c2]
set zig "Zig" [c3]
go: Ana, Ben
go & rust: Cy
go & rust & zig: Dee (writes all three)
rust: Eve, Fay
zig: 4 people
```

With steps, one set comes in at a time, with its regions.

```venn title="Adding one set at a time"
set a "Readers" [c4]
set b "Writers" [c5]
set c "Reviewers" [c6]
@step Readers and writers overlap.
a: Ana, Ben
a & b: Cy
b: Dee
@step Reviewers join; some people do all three.
c: Eve
a & b & c: Fay
```

## Video

A video part keeps the browser's video and draws its own controls: a big play button on the poster, a bar with the chapters as segments (point at it to see the chapter and a still), captions drawn by us from a WebVTT file, picture in picture and full screen. The picture here is a made-up moving gradient.

```video src="media/sample.mp4" poster="media/poster.jpg" title="Colours drifting" duration=0:12
captions: media/sample.en.vtt "English" default
thumbs: media/thumbs.vtt
chapter 0:00 Warm
chapter 0:04 Cool
chapter 0:08 Bright
0:00 The colours drift slowly across the frame.
0:04 Captions are drawn by the part from a WebVTT file.
0:08 Press C to turn them off, and F for full screen.
```

`clip` is for a short screen recording that would otherwise be a GIF: it plays muted and in a loop while it is on screen, stops when it scrolls away, and stays still when the reader asks for less motion.

```video src="media/clip.mp4" title="A short silent loop" clip height=s
```

## Wardley map

Components by evolution (left to right) and visibility (top to bottom). Positions are named keys, so the two numbers cannot be swapped.

```wardley title="A tea shop"
anchor customer "Customer" visible=0.95 evolution=0.6
component cup "Cup of tea" visible=0.8 evolution=0.6
component tea "Tea" visible=0.6 evolution=0.8
component kettle "Kettle" visible=0.45 evolution=0.4
component power "Power" visible=0.1 evolution=0.85
customer -> cup
cup -> tea
cup -> kettle
kettle -> power
note "Kettles are a product now" visible=0.3 evolution=0.1
@step Today the kettle is a product we buy.
highlight kettle
@step A smart kettle moves it further to the right.
evolve kettle 0.65 "smart kettle"
```

## Weather

A forecast written in the source; it never fetches. The units menu on the part switches °C and °F, km/h, mph, m/s and knots, mm and inches, hPa and inHg, and your choice is remembered in this browser.

```weather place="San Francisco" unit=c tz=America/Los_Angeles
2026-11-22 sun 18/11 rain=0% wind=12km/h pressure=1021hPa
2026-11-23 partly 16/10 rain=10% wind=15km/h pressure=1018hPa
2026-11-24 rain 14/9 rain=80% wind=30km/h precip=6mm pressure=1004hPa
2026-11-25 storm 13/8 rain=95% wind=45km/h precip=14mm pressure=996hPa note="Ferry may stop"
2026-11-26 cloud 12/7 rain=30% wind=20km/h precip=1mm pressure=1009hPa
```

Hours work the same way, with one temperature, here written in °F and mph.

```weather place="Oakland" unit=f wind=mph tz=America/Los_Angeles
2026-11-24 06:00 fog 48 rain=5% wind=4mph
2026-11-24 09:00 cloud 52 rain=20% wind=8mph
2026-11-24 12:00 drizzle 57 rain=60% wind=11mph
2026-11-24 15:00 rain 59 rain=85% wind=14mph
2026-11-24 18:00 rain 55 rain=70% wind=12mph
2026-11-24 21:00 cloud 51 rain=25% wind=7mph
```

The same forecast with `static`: drawn whole in the fence's unit, with no menu.

```weather static place="Sydney" unit=c wind=kmh
2026-11-22 sun 24/17 rain=0% wind=14km/h
2026-11-23 partly 22/16 rain=20% wind=18km/h
2026-11-24 sleet 3/-1 rain=70% wind=22km/h note="Ice on the road"
```

:::accordion
#### Source: `fixtures/parts/samples.dh.md`
````text
---
title: The folder parts
---
<!-- generated by scripts/parts.ts from the folders under src/parts/: do not edit -->

# The folder parts

Every part that lives in its own folder, with its sample. The Format page shows each as source, drawing and LLM view.

## Audio

An audio part is a player of our own. The wave is drawn from a small peaks file and moves with the sound; chapters split it, a marker flags one moment, and the transcript follows the voice.

```audio src="media/talk.mp3" title="A page that talks" duration=0:57 wave=bars skip=10 transcript=open
peaks: media/talk.peaks.json
chapter 0:00 Welcome
chapter 0:24 The transcript
chapter 0:38 The marker
marker 0:38 Where the example crashed [bad]
0:00 Ana: Welcome back. Today we look at a page that can talk.
0:04 Ben: A page that talks. Do you mean the audio part?
0:08 Ana: Yes. You write one fence, with a file, a title, and a few lines of transcript.
0:14 Ben: And the reader sees a wave that moves while the voice plays.
0:18 Ana: The wave is drawn from a small peaks file, so it appears before the sound starts.
0:24 Ben: What about people who cannot listen right now?
0:27 Ana: The transcript follows the voice. Tap a line, and the player jumps there.
0:33 Ben: Chapters split the wave into parts, and a marker flags one moment.
0:38 Ana: Here is the marker. This is where the example crashed.
0:42 Ben: And a language model reads the same page as plain text.
0:46 Ana: It gets the title, the chapters, and the transcript, never a picture of a wave.
0:52 Ben: That is the whole part. Press play, and listen again.
```

`wave=mirror` reflects the wave, `wave=dots` draws it in dots, `wave=live` shows a window of the sound that scrolls past "now", and `compact` makes one row. The colour is a word (`tone=c4`), never a hex value.

```audio src="media/talk.mp3" title="Mirror wave, in family colour 4" wave=mirror tone=c4 height=s duration=0:57
peaks: media/talk.peaks.json
```

```audio src="media/talk.mp3" title="Compact" compact wave=line duration=0:57
peaks: media/talk.peaks.json
```

## Calendar

The host supplies no clock here: Today returns to the authored date. Explore the views, switch calendars and open events. A narrow part starts with three days.

```calendar title="Release week" tz=Europe/London date=2026-11-23 view=week hours=08-18
calendar team "Team" [c2]
2026-11-23 09:00-09:20 Stand-up in team every weekday times=5
2026-11-24 10:00-11:30 Design review @ Studio in team note="Bring the mock-ups"
2026-11-24 10:30-11:00 Review notes in team
2026-11-25 all day Code freeze [warn]
2026-11-26 18:00-19:00 Sydney call tz=Australia/Sydney
```

The static form keeps a complete dated list without controls.

```calendar title="Release checklist" tz=Europe/London date=2026-11-23 static
calendar team "Team" [c2]
2026-11-23 09:00-09:20 Stand-up in team every weekday times=3
2026-11-25 all day Code freeze [warn]
```

## Chart kinds

Eight more kinds of a `chart`, each a YAML map with `kind:` at the top: raw values are counted, quartiled or smoothed when the page is built, so a model reads the table. Hover, tap or focus a bin, box, stage, block or day for its card; the arrow keys walk the data.

```chart
kind: histogram
title: How long a request takes
x: { label: latency, format: duration-ms }
y: { label: requests }
bins: 12
marks: [p50, p95]
data: [74, 88, 109, 110, 86, 88, 122, 87, 132, 140, 93, 50, 99, 127, 56, 69, 80, 114, 67, 66, 89, 95, 125, 102, 120, 73, 91, 107, 42, 78, 75, 99, 155, 115, 25, 54, 113, 82, 84, 85, 94, 121, 168, 191]
```

```chart
kind: boxplot
title: Checkout time by day
x: { label: day, values: [Mon, Tue, Wed] }
y: { label: seconds to pay, format: duration }
tone: c4
data:
  - [120, 100, 121, 110, 106, 125, 169, 146, 134, 102, 132, 128, 114, 152]
  - [173, 121, 152, 144, 132, 143, 153, 117, 130, 134, 146, 176, 149, 166]
  - [118, 116, 162, 140, 161, 166, 136, 170, 158, 138, 126, 160, 154, 260]
```

```chart
kind: violin
title: Response time by service
x: { label: service, values: [api, search, checkout] }
y: { label: response, format: duration-ms }
tone: c2
data:
  - [57, 69, 117, 111, 105, 83, 98, 105, 124, 101, 88, 102, 117, 83, 99, 101, 101, 99]
  - [141, 198, 207, 164, 144, 149, 163, 206, 121, 232, 154, 227, 237, 119, 174, 148, 195, 192]
  - [243, 242, 239, 262, 246, 212, 247, 222, 252, 201, 213, 203, 204, 248, 234, 261, 258, 213]
```

```chart
kind: funnel
title: From visit to paid
tone: c1
data:
  - [Visited the site, 48200]
  - [Created an account, 8700]
  - [Started a trial, 4100]
  - [Paid, 1350]
steps:
  - title: Last quarter.
  - title: After the shorter sign-up form.
    data:
      - [Visited the site, 49500]
      - [Created an account, 11300]
      - [Started a trial, 5200]
      - [Paid, 1720]
```

```chart
kind: waterfall
title: Monthly revenue bridge
x: { label: driver, values: [October, New, Churn, Refunds, Subtotal, Price rise, November] }
y: { label: revenue, format: money, currency: EUR }
data: [84000, 12500, -9100, -2300, "=", 4800, "="]
```

```chart
kind: treemap
title: Where the disk went
y: { label: disk use, format: bytes }
data:
  - name: Media
    children:
      - { name: Videos, value: 412000000000 }
      - { name: Photos, value: 186000000000 }
  - name: Code
    children:
      - { name: Repos, value: 86000000000 }
      - { name: Build cache, value: 88000000000 }
  - { name: Backups, value: 140000000000 }
```

```chart
kind: sunburst
title: Lines of code by team and area (thousands)
y: { label: lines of code }
data:
  - name: Platform
    children:
      - { name: Runtime, value: 93 }
      - { name: Storage, value: 66 }
  - name: Product
    children:
      - { name: Web, value: 95 }
      - { name: Mobile, value: 69 }
  - { name: Docs, value: 18 }
```

```chart
kind: calendar
title: Commits, September to November
y: { label: commits }
tone: good
from: 2026-09-01
to: 2026-11-30
data: [["2026-09-01", 7], ["2026-09-02", 6], ["2026-09-03", 5], ["2026-09-07", 4], ["2026-09-09", 2], ["2026-09-12", 2], ["2026-09-14", 4], ["2026-09-15", 10], ["2026-09-16", 1], ["2026-09-17", 3], ["2026-09-18", 5], ["2026-09-21", 8], ["2026-09-23", 9], ["2026-09-24", 5], ["2026-09-25", 3], ["2026-09-26", 2], ["2026-09-27", 1], ["2026-09-28", 9], ["2026-09-29", 8], ["2026-09-30", 7], ["2026-10-01", 8], ["2026-10-02", 9], ["2026-10-04", 1], ["2026-10-05", 5], ["2026-10-06", 9], ["2026-10-11", 2], ["2026-10-12", 9], ["2026-10-13", 9], ["2026-10-15", 5], ["2026-10-16", 6], ["2026-10-17", 1], ["2026-10-18", 1], ["2026-10-20", 8], ["2026-10-21", 3], ["2026-10-22", 6], ["2026-10-23", 6], ["2026-10-24", 1], ["2026-10-25", 1], ["2026-10-26", 2], ["2026-10-29", 7], ["2026-10-30", 7], ["2026-10-31", 1], ["2026-11-01", 0], ["2026-11-04", 4], ["2026-11-06", 5], ["2026-11-07", 0], ["2026-11-08", 0], ["2026-11-09", 2], ["2026-11-11", 2], ["2026-11-12", 6], ["2026-11-13", 8], ["2026-11-14", 2], ["2026-11-15", 0], ["2026-11-16", 8], ["2026-11-17", 6], ["2026-11-18", 3], ["2026-11-19", 1], ["2026-11-21", 2], ["2026-11-22", 2], ["2026-11-23", 3], ["2026-11-24", 8], ["2026-11-26", 7], ["2026-11-27", 10], ["2026-11-28", 0], ["2026-11-29", 1], ["2026-11-30", 7]]
```

Each kind takes `title`, `tone` where it makes sense, `y: { label, format, currency }` for the value axis (the histogram's is `x`), and `steps:` that change `data`, `marks` or `bins` from one step to the next.

## Compare

**A comparison matrix puts options side by side, one line for each thing you judge them on.** The first line names the options; every other line is a criterion and one value for each option, in the same order. A note in round brackets shows when a reader hovers, focuses or taps the value. With `winner=on` the best value of each yes/no, scored or good/bad row is marked; `pick=` flags the option you recommend.

```compare title="Which queue?" winner=on pick=Kafka
options: Redis Streams [c1], Kafka [c2], SQS [c3]
Ordering: yes, yes, partial (FIFO queues only)
Runs itself: no, no, yes
Throughput: 3, 5, 3 (score 1-5)
Latency (lower is better): 4 ms (in one region), 12 ms, 25 ms
Replay old messages: yes (until trimmed), yes (by offset), no
Cost at our size: good, bad, good (pay per request)
Team knows it: yes, partial (two people), yes
```

With `view=single`, a phone shows one option at a time, chosen from buttons. Here the values are plain words and good, warn and bad, so no row is marked as the best.

```compare title="Where to host the docs" view=single
options: Own servers, Static host, Wiki service
Set-up time: a week, an hour, a day
Custom domain: good, good, warn (paid plan only)
Search: warn (add one), warn (add one), good
Who can edit: developers, developers, anyone with an account
```

## Compare image

**A before-and-after picture lays two images of the same size on top of each other, with a bar between them.** Drag the bar (or anywhere on the picture), press the arrow keys, or tap the picture to flip from one to the other; the two labels jump to a whole image. Each image line gives the address and the alt text in quotes, which is what a screen reader and an LLM read. The address goes through the host's URL policy (a relative path, http or https; never `data:`). The two sample images are the files `before-light.svg` and `after-dark.svg` in this part's `media/` folder: a host serves that folder as `media/`.

```compare-image title="A dashboard, light and dark" before="Light" after="Dark"
before: media/before-light.svg "A dashboard with four tiles and a bar chart on a light page"
after: media/after-dark.svg "The same dashboard on a dark page"
```

## Diff

A `diff` block holds what `git diff` prints. It is drawn as a diff view: a file header with how much changed, line numbers on both sides, the changed words marked inside a changed line, and long unchanged runs folded. It is split on a wide part and unified on a narrow one; the buttons switch it, and `view=split` or `view=unified` fixes it. On a phone the lines do not wrap: the numbers and the sign stay in view while the code scrolls inside its box.

```diff
diff --git a/src/server.ts b/src/server.ts
index 4b825dc..9f3c1a7 100644
--- a/src/server.ts
+++ b/src/server.ts
@@ -12,9 +12,10 @@ export function start(config: Config) {
   const port = config.port ?? 8080;
-  const host = "localhost";
+  const host = config.host ?? "0.0.0.0";
   const server = createServer(handler);
-  server.listen(port, host);
+  server.listen(port, host, () => log.info("listening", { port, host }));
   register(server);
   watch(config);
   return server;
@@ -48,6 +49,6 @@ export function stop(server: Server) {
   unwatch();
-  server.close();
+  server.close(() => log.info("closed"));
 }
@@ -80,18 +81,19 @@ export function reload(server: Server) {
   const next = readConfig();
-  if (next.port !== current.port) restart(server);
+  if (next.port !== current.port || next.host !== current.host) restart(server);
   current = next;
   emit("reload", next);
   mark("reload");
   audit(next);
   notify(next);
   flush();
   settle();
   prune();
   index();
   compact();
   verify();
+  log.debug("reloaded", { port: next.port });
   return server;
 }
```

With `static` the diff is drawn whole, with no button: every file open, and a folded run only says how many lines it holds.

```diff static
--- a/src/greet.ts
+++ b/src/greet.ts
@@ -1,4 +1,4 @@
 export function greet(name: string) {
-  return "Hello, " + name;
+  return `Hello, ${name}!`;
 }
```

## Downloads

A card for each file: a type icon, its size, a plain download link, and a checksum that copies on a tap, with the line that checks it. Nothing is counted and nothing is fetched until the reader presses Download.

```downloads title="Files for this page"
media/report.pdf "The report, first pages" 209 KB sha256=d14bdfa9e9a37c960e8a2835fd6c0e75aa6e201e1e967d18159378e3de124372
media/talk.mp3 "The spoken sample" 229 KB sha256=8ed40d5dc963c74c457b987f9af4b4f3a33f1c13aa7a547cd3e959bf6fcd5d55
media/build.json "The hand-written animation" 6.4 KB note="A Lottie file with no expressions and no images."
https://example.com/durian-markdown-0.7.0.tar.gz "Source archive (an example address)" 1.2 MB sha256=2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae note="The address is an example; nothing is fetched until you press Download."
media/requests.csv "Raw data" 15.4 KB note="One row per request."
```

## Explore

A fence in the data's own language, followed by `explore`, becomes a foldable tree with a search box, a copy-path button on every key and a **jq subset** query box. It reads JSON, YAML or CSV (a CSV's rows become objects). `query=` is the starting query. The box runs our own small jq (the "jq subset": paths, pipes, `select`, `map`, `keys`, `length`, `sort_by`, `group_by`, `to_entries`, `test`, string interpolation, building objects and arrays); a query that needs more work than a page may use says so, and a function outside the subset is named, never answered wrongly. It lacks assignment (`|=`), `reduce`, `foreach`, `def`, `paths`, `del`, `sub`, `gsub`, `match` and `walk`.

```json explore title="One order" query=".lines[] | select(.qty > 1)"
{
  "id": "o-7",
  "customer": { "id": "c-12", "name": "Ana", "tags": ["vip", "early"] },
  "lines": [
    { "sku": "tea", "qty": 2, "price": 3.5 },
    { "sku": "cup", "qty": 1, "price": 8 },
    { "sku": "pot", "qty": 3, "price": 12.25 }
  ],
  "paid": true,
  "note": null
}
```

The same reader takes YAML and CSV. TOML exploration is refused until a TOML reader is available; the TOML example below is ordinary code:

```yaml explore title="A service config" query=".limits | map_values(ascii_upcase)"
service: shop
replicas: 3
limits:
  cpu: 500m
  mem: 256Mi
hosts:
  - name: app-1.example.com
    zone: a
  - name: app-2.example.com
    zone: b
```

```toml
[server]
host = "198.51.100.7"
port = 8443
tls = true

[limits]
cpu = "500m"
```

```csv explore title="Latency by region" query="sort_by(.p95) | reverse | .[0].region"
region,p50,p95,requests
us-west,42,120,1200000
eu-central,55,180,830000
ap-south,70,260,410000
```

## Fishbone

Causes by category along a spine into the effect. In a narrow column the spine turns vertical.

```fishbone title="Why is checkout slow?"
effect: Checkout takes 4 seconds at p95
People: on-call is new to the service
Process: no load test before a release
  only staging has real data
Tools: the ORM loads every line item
  one query per line
Environment: the database is in another region
```

With steps, the bones come in one at a time, and `highlight` lights one.

```fishbone title="Why did the deploy fail?"
effect: The deploy rolled back
@step The first two causes.
Config: a key was renamed in one place only
Tests: the contract test was skipped
@step The third, and the one to fix first.
Release: two services shipped in the wrong order
highlight Config
```

## Flame chart and flame graph

A traced request and folded profiler stacks. Tap a frame to zoom; search highlights matching frames.

```flame title="One request, traced" unit=ms
0 120 request
  2 14 auth.check
  15 95 handler.order
    16 70 db.query
    72 90 render.page
  96 118 respond.write
```

```flame title="CPU, 30 seconds" unit=samples colour=heat
main;serve;handle;parse 120
main;serve;handle;db.query 300
main;serve;handle;db.query;lock.wait 80
main;serve;handle;render.page 95
main;serve;gc 45
main;serve;accept 30
main;housekeeping;flush 60
```

## Gallery

A carousel shows one image at a time: swipe, use the arrow keys, the buttons or the dots. A tap opens the picture full screen, where pinch, wheel and double tap zoom it, and one finger or the mouse pans.

```gallery title="Four sample pictures" view=carousel loop
![A harbour at dawn: a low sun over a still sea](media/harbour.svg "Harbour at dawn: a made-up picture for the sample")
![A pine forest in green light](media/forest.svg "Pine forest")
![Sand dunes under a pale sky](media/dunes.svg "Dunes at noon")
![A mountain behind a lake](media/lake.svg "Mountain lake")
```

A grid crops to a ratio (the full picture stays in the lightbox), with the caption under each image.

```gallery title="The same pictures, as a grid" view=grid columns=3 ratio=4:3
![A harbour at dawn](media/harbour.svg "Harbour")
![A pine forest](media/forest.svg "Forest")
![Sand dunes](media/dunes.svg "Dunes")
![A mountain lake](media/lake.svg "Lake")
```

One image, with zoom.

```gallery view=single
![A mountain behind a lake](media/lake.svg "Tap the picture to see it full screen")
```

## Gantt

A task line is `<id> "label" <start> <end or length> [progress%] [done] [colour]`; a start is a date or `after <id> ...`; `milestone` is a point; `section` groups the lines after it. `today=` draws a line (never the real clock). Hover, tap or focus a bar for its dates and what it waits for; Day, Week and Month change the scale.

```gantt title="Release 2.0" today=2026-12-09
section Build
design "Design" 2026-12-01 .. 2026-12-04 done
api "API" after design 8d 60%
ui "Screens" after design 6d
section Ship
beta "Beta" after api ui 3d [warn]
launch "Launch" milestone after beta
```

Under steps, `progress`, `done` and `move` change the plan as time passes; a slip carries the tasks after it. `workdays=on` makes lengths skip Saturday and Sunday, and `critical=on` outlines the longest chain.

```gantt title="A release that slips" workdays=on critical=on today=2026-12-14
section Build
design "Design" 2026-12-01 .. 2026-12-04 done
api "API" after design 8d 40%
ui "Screens" after design 6d
section Test
qa "QA" after api ui 5d
@step The plan on 1 December
@step Design is done, the API is under way
progress api 60%
progress ui 100%
@step The API slips by a week
move api 2026-12-14
launch "Launch" milestone after qa
```

## Glossary

Terms defined once. Where a term is used in the text, its first use in each section is a button with a dotted underline: hover it, tap it, or focus it and press Enter to read the meaning.

```glossary title="Words we use"
term "UL" also "ubiquitous language": the words a team agrees on and uses in code and in talk
term bc "bounded context" also "context map": one part of the system with its own **words**; see [the book](https://example.com/ddd)
```

Each team keeps its own UL inside a bounded context. The second use of UL in the same section stays plain text: UL.

## Graph

A graph is for finding your way around a big network: what uses what, and what breaks if one part goes. Write `group` and `node` lines, then one edge a line (`a -> b`, with a label in quotes if it needs one). A node an edge names and no line declares is added (here the outside libraries). `layout=layers` puts each package above what it uses. **Explore it:** search a package, tap one to focus it and its neighbours (1 or 2 steps out), fold a group into one box, pan and zoom; the list beside the graph shows its links in and out. A graph this size reads as over 400 tokens, so the `:::llm` after it says the same in short.

```graph title="A shop's packages, and what each one uses" layout=layers
group apps "apps" [c1]
group ui "user interface" [c4]
group domain "domain" [c2]
group data "data access" [c6]
group core "core" [c3]
group tools "build and test" [muted]
node web "web shop" in apps
node admin "admin console" in apps
node worker "background worker" in apps
node cli "command line" in apps
node ui-kit, charts, forms, icons, theme in ui
node cart, checkout, catalog, accounts, search, pricing, orders, money, auth in domain
node db, cache, queue, events, http-client, storage in data
node config, log, errors, util, i18n, time in core
node build, lint, test-kit in tools
web -> ui-kit, forms, cart, checkout, catalog, search, accounts, i18n
admin -> ui-kit, charts, forms, orders, catalog, accounts
worker -> orders, events, queue, log
cli -> config, catalog, db
ui-kit -> theme, icons, react
charts -> ui-kit, chart.js "lazy"
forms -> ui-kit, zod
cart -> pricing, catalog, cache
checkout -> cart, orders, money, auth
catalog -> db, search, storage
accounts -> auth, db, events
search -> http-client, cache
pricing -> money, catalog
orders -> db, money, events, queue
money -> util
auth -> db, cache, errors
db -> pg, config, log, errors
cache -> ioredis, config
queue -> ioredis, events
events -> log, time
http-client -> undici, errors
storage -> http-client, config
config -> zod, util
log -> time, util
errors -> util
i18n -> date-fns, util
time -> date-fns
test-kit -> db, cache, config "fakes"
build, lint -> config
```

:::llm
A layered package graph of a shop: 33 packages in 6 groups, plus 7 outside libraries (react, chart.js, zod, pg, ioredis, undici, date-fns); 80 edges. The apps (web shop, admin console, background worker, command line) use the user interface packages (ui-kit, charts, forms, icons, theme) and the domain packages (cart, checkout, catalog, accounts, search, pricing, orders, money, auth). The domain uses data access (db, cache, queue, events, http-client, storage), which uses core (config, log, errors, util, i18n, time). Checkout needs cart, orders, money and auth; auth needs db, cache and errors. Most connected: db (6 in, 4 out), config (7 in, 2 out), web (8 out), catalog (5 in, 3 out).
:::

`layout=force` pulls linked services together and pushes the rest apart, so the clusters show. It fits calls between services, where there is no top or bottom. An id may carry a numbered range: `node db-orders-{1..6} in data` declares six shards, and `orders -> db-orders-{1..6}` draws a line to each. **Fold a group** (beside the graph, or a double tap on its box) and its lines join on one box with a count; **Fold groups** folds them all. A graph over 300 nodes, or one that would be drawn too small to touch in its box (a phone), starts with every group folded. Its LLM view is the nodes by group, the edges as `a -> b` lines, and the most connected nodes: here far over 400 tokens, so a `:::llm` says it in short.

```graph title="Calls between the services of a shop" layout=force size=l
group edge "edge" [c1]
group identity "identity" [c2]
group catalog "catalog" [c3]
group orders "orders" [c4]
group payments "payments" [c5]
group fulfil "fulfilment" [c6]
group data "data stores" [c8]
group platform "platform" [c7]
node cdn, waf, gateway, web-bff, mobile-bff, admin-bff, graphql, rate-limit, bot-check, geo-route, edge-cache, ws-hub, upload-proxy, img-proxy, status-page in edge
node auth, sessions, users, profiles, roles, mfa, sso, tokens, consent, audit, password-reset, email-verify, devices, risk-score, api-keys in identity
node catalog-api, products, variants, inventory, prices, promos, reviews, search-api, indexer, recs, media, categories, brands, bundles, wishlist in catalog
node cart-api, checkout, orders-api, order-events, invoices, returns, refunds, tax, shipping-quote, gift-cards, loyalty, quotes, subscriptions, order-history, fraud in orders
node pay-api, card-vault, psp-a, psp-b, wallets, payouts, ledger, fx, disputes, settlements, pay-events, three-ds, chargebacks, billing, receipts in payments
node fulfil-api, warehouses, picking, packing, carriers, labels, tracking, dispatch, slots, couriers, stock-sync, returns-in, notify, sms, email in fulfil
node db-orders-{1..6}, db-users, db-catalog, cache-{1..3}, search-index, blob-store, event-bus, dw in data
node config-svc, flags, secrets, metrics, logs, traces, scheduler, jobs, alerts, ci, registry, mesh, dns, kms, backups in platform
cdn -> edge-cache, img-proxy, waf
waf -> gateway, bot-check, rate-limit
gateway -> web-bff, mobile-bff, admin-bff, graphql, ws-hub, upload-proxy, geo-route
web-bff -> auth, sessions, catalog-api, cart-api, search-api, recs, checkout
mobile-bff -> auth, sessions, catalog-api, cart-api, search-api, wishlist, checkout
admin-bff -> auth, roles, catalog-api, orders-api, refunds, users, audit
graphql -> catalog-api, orders-api, profiles, reviews
ws-hub -> tracking, order-events, sessions
upload-proxy -> media, blob-store
img-proxy -> media
status-page -> metrics, alerts
auth -> sessions, users, mfa, sso, tokens, risk-score, devices
sessions -> cache-1, tokens
users -> db-users, profiles, email-verify, audit
profiles -> db-users, media, consent
roles -> db-users, audit
mfa -> sms, email, devices
sso -> tokens, users
tokens -> kms, cache-1
password-reset -> email, tokens, users
email-verify -> email
api-keys -> tokens, db-users
risk-score -> devices, fraud
catalog-api -> products, categories, brands, prices, inventory, media, bundles
products -> variants, db-catalog, cache-2
variants -> db-catalog
inventory -> db-catalog, stock-sync, event-bus
prices -> promos, fx, cache-2
promos -> db-catalog
reviews -> db-catalog, users
search-api -> search-index, recs
indexer -> search-index, event-bus, products
recs -> dw, cache-2
wishlist -> db-users, products
cart-api -> products, prices, promos, cache-3, gift-cards
checkout -> cart-api, tax, shipping-quote, pay-api, orders-api, fraud, loyalty
orders-api -> db-orders-{1..6}, order-events, invoices
order-events -> event-bus
invoices -> tax, receipts, blob-store
returns -> orders-api, returns-in, refunds
refunds -> pay-api, ledger
tax -> fx
shipping-quote -> carriers, slots
gift-cards -> ledger
loyalty -> users, ledger
quotes -> prices, tax
subscriptions -> billing, orders-api, scheduler
order-history -> db-orders-{1..6}, dw
fraud -> risk-score, dw
pay-api -> card-vault, psp-a, psp-b, wallets, three-ds, ledger, pay-events
card-vault -> kms, secrets
psp-a, psp-b -> pay-events
wallets -> ledger
payouts -> ledger, psp-a, settlements
ledger -> fx, dw
disputes -> chargebacks, psp-a, psp-b
settlements -> ledger, dw
pay-events -> event-bus
chargebacks -> ledger
billing -> pay-api, receipts
receipts -> email, blob-store
fulfil-api -> warehouses, dispatch, labels, tracking
warehouses -> stock-sync, picking
picking -> packing
packing -> labels
labels -> carriers, blob-store
carriers -> tracking
tracking -> notify, event-bus
dispatch -> couriers, slots, carriers
stock-sync -> inventory, event-bus
returns-in -> warehouses, refunds
notify -> sms, email
event-bus -> fulfil-api, indexer, notify, dw, audit
scheduler -> jobs
jobs -> backups, indexer, payouts, settlements
alerts -> metrics, logs
mesh -> dns, traces, metrics
backups -> blob-store
ci -> registry
config-svc -> flags, secrets
secrets -> kms
gateway, auth, checkout, pay-api, orders-api -> mesh
```

:::llm
A force-laid call graph of a shop: 120 services in 8 groups, 232 calls. Edge (cdn, waf, gateway, three backends for web, mobile and admin, graphql, ws-hub ...) calls identity (auth, sessions, users, tokens, mfa, sso ...) and catalog (catalog-api, products, prices, search-api, recs ...). Checkout calls cart-api, tax, shipping-quote, fraud, loyalty, pay-api and orders-api; orders-api writes six shards, db-orders-1 to db-orders-6. pay-api calls card-vault, two payment providers, wallets, three-ds and the ledger. Events go through event-bus to fulfilment (warehouses, picking, packing, labels, carriers, tracking), the indexer, notify, the warehouse (dw) and audit. Platform: config, flags, secrets, kms, metrics, logs, traces, the mesh, scheduler and jobs. Most connected: orders-api (5 in, 9 out), auth, catalog-api, pay-api, event-bus (6 in, 5 out).
:::

`layout=radial centre=<node>` puts one node in the middle and each ring one step further away, in either direction: what it uses and what uses it. Use it to answer "what touches this?". A small graph needs no `:::llm`: its LLM view is the graph itself, as lines.

```graph title="What touches the sign-in service" layout=radial centre=auth
group callers "calls sign-in" [c1]
group needs "sign-in calls" [c6]
node web, mobile, admin, cli in callers
node sessions, users, mfa, tokens in needs
node auth "sign-in"
web, mobile, admin, cli -> auth
auth -> sessions, users, mfa, tokens
mfa -> sms "codes"
tokens -> kms "signing keys"
sessions, users -> postgres
```

`static` draws the part still: the groups with how many nodes each holds, and a line that counts the edges between two groups. It is for print, a PDF, an email, or a reader who asks for less motion.

```graph title="The same sign-in graph, drawn still" layout=radial centre=auth static
group callers "calls sign-in" [c1]
group needs "sign-in calls" [c6]
node web, mobile, admin, cli in callers
node sessions, users, mfa, tokens in needs
node auth "sign-in"
web, mobile, admin, cli -> auth
auth -> sessions, users, mfa, tokens
mfa -> sms "codes"
tokens -> kms "signing keys"
sessions, users -> postgres
```

## Http

An `http` block is a request and, after a blank line, its response, as text. It is drawn as a method tag and the address (the query split into names and values), the headers (folded after six), the body (JSON is pretty and can be folded), the status as a tag coloured by its class, and a button that copies the request as `curl`. A secret in a header is never written out: use a placeholder such as `<token>`.

```http title="Create an order"
POST /v1/orders?dry_run=false&currency=usd HTTP/1.1
Host: api.example.com
Content-Type: application/json
Accept: application/json
Authorization: Bearer <token>
Idempotency-Key: 6f1c2d0e
User-Agent: shop-cli/2.4
X-Request-Id: req-7a91

{ "sku": "tea", "qty": 2, "ship": { "to": "198.51.100.7", "express": true }, "notes": ["gift", "no receipt"] }

HTTP/1.1 201 Created
Content-Type: application/json
Location: /v1/orders/o-7

{ "id": "o-7", "status": "open", "total": { "amount": 1840, "currency": "usd" } }
```

With `static` the whole message is drawn: every header, the whole JSON tree, no button.

```http static
HTTP/1.1 404 Not Found
Content-Type: application/json
Cache-Control: no-store

{ "error": "not_found", "detail": { "resource": "order", "id": "o-9" } }
```

## Log

A fence named `log`. It reads JSON lines, logfmt and the common "time level message key=value" shape. The filter box speaks **LogQL** (Grafana Loki's query language): `{level="error"}`, `|= "timeout"`, `!= "health"`, `|~ "5\\d\\d"`, `| status >= 500`; a box that starts with neither `{` nor `|` is plain words. Only the query half of LogQL is read, never metric queries. `filter=` is the starting filter. The author (often an agent) points at what matters with `@highlight` lines: a LogQL filter or `line 3-5`, a colour word and the reason in quotes.

```log title="The failed deploy" labels="app=shop, env=prod" filter="{level=~\"warn|error\"}"
2026-11-20T10:08:01Z info  deploy started version=1.4
2026-11-20T10:08:12Z info  migration applied name=0042
2026-11-20T10:09:03Z warn  cache miss rate high rate=0.41
2026-11-20T10:09:05Z error request failed path=/cart status=500 err="timeout after 30s" span=checkout trace=request
2026-11-20T10:09:06Z error request failed path=/cart status=500 err="timeout after 30s" span=checkout trace=request
@highlight |= "timeout" [bad] "every failure is the same timeout"
@highlight line 3 [warn] "the first sign"
```

## Lottie

A Lottie file is a drawing that moves. This one was written by hand for the sample: a box fills with blocks, one row at a time, then a tick appears. It plays while it is on screen, stops off it, and shows one still frame when the reader asks for less motion. The `colours:` line maps names inside the file to theme colours, so it follows light and dark.

```lottie src="media/build.json" title="What happens while it builds" loop
alt: A box fills with blocks, one row at a time, then a tick appears.
colours: dh-c1 = c1, dh-c2 = c2, dh-c3 = c3, dh-good = good
```

## Map and routes

Places and written routes work without a tile provider. A dashed route has no road geometry; the host may supply its own router.

```map title="Walk to the garden"
place start "Library" 51.507, -0.128 [c1] note="Meet by the entrance"
place garden "Garden" 51.511, -0.117 [c2]
route walk "Morning walk" by=walk [c2]: start -> 51.508, -0.123 -> garden
@step Meet at the library.
focus start
@step Follow the written route.
show walk
focus walk
```

Country values, US states and flows share the same map and value list.

```map title="Daily flow" unit="units per day" scale=steps steps=4
fill DE 83.2
fill FR 68.4
fill US-CA 39.5
arc DE -> FR 24 "Daily flow" [c2]
```

The globe uses the same data; with no WebGL it falls back to the flat map.

```map title="Global flow" view=globe spin=off unit="units per day"
fill DE 83.2
fill FR 68.4
arc DE -> FR 24 "Daily flow" [c2]
```

A static globe is a flat map with all its values, ready to print.

```map title="A still map" view=globe static
fill DE 83.2
fill FR 68.4
```

## Maths (`$...$`, `$$...$$` and `math`)

The area of a circle is $A = \pi r^2$, and a sum of the first $n$ numbers is:

$$
\sum_{k=1}^{n} k = \frac{n(n+1)}{2}
$$

The same in a `math` block, with a fraction, a root and a matrix:

```math
x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a} \qquad
\begin{pmatrix} 1 & 0 \\ 0 & 1 \end{pmatrix}
```

Prices stay text: it costs $5 and $10, and `$not maths$` in code is left alone.

## PDF

pdf.js draws the pages on a canvas, and its text layer makes the words selectable and searchable. The file below was printed from a small made-up document. The viewer works a page at a time; try the search box, the outline and the zoom.

```pdf src="media/sample.pdf" title="A sample document" page=1 height=l
```

`view=scroll` lays every page out in one scrolling column and draws the ones near the window.

```pdf src="media/sample.pdf" title="The same file, scrolling" view=scroll height=s
```

## Citations (`[@key]` and `references`)

A mark in the text opens its entry: marks make a study easier to read [@smith2020, p. 12], and two together are one group [@smith2020; @lee2019]. Hover, focus or tap a mark for the entry.

```references style=apa title="References"
- id: smith2020
  author: Smith, Jane; Lee, Kim
  title: A study of marks
  in: Journal of Studies
  year: 2020
  volume: 12
  issue: 3
  pages: 10-20
  doi: 10.1234/jbs.2020.4
- id: lee2019
  author: Lee, Kim
  title: Notes on lists
  type: web
  publisher: Example Press
  year: 2019
  url: https://example.com/notes
  accessed: 2026-11-20
```

## Sankey

A flow a line, `from -> to: amount`; `node <id> "label" [colour]` only to name or colour one. Hover, tap or focus a band to light its path and read its share.

```sankey title="Where a request's time goes" unit=ms
request -> auth: 12
request -> handler: 80
handler -> db: 55
handler -> render: 20
handler -> cache: 5
node db "Postgres" [c3]
node cache "Redis" [c2]
```

Flows under a step appear in it: the bands grow out of their source. In a narrow column, a sankey with more than three columns runs top to bottom.

```sankey title="Where the month's budget goes" unit=USD
income -> payroll: 62000
income -> infra: 21000
income -> tools: 6000
income -> reserve: 11000
@step The money in and the big three
@step Infrastructure breaks down
infra -> compute: 12500
infra -> storage: 5200
infra -> network: 3300
@step Compute splits by team
compute -> web: 7000
compute -> data: 4100
compute -> ml: 1400
node income "Revenue" [c1]
node payroll "People" [c4]
node infra "Infrastructure" [c6]
```

## Sequence

Who calls whom, in order. A call is a solid arrow, a reply a dashed one; a block (`loop`, `alt`, `opt`, `par`) frames the messages inside it. An LLM reads the messages as a numbered list.

```sequence title="One init call"
actor dev "developer"
participant cli "CLI"
participant tc "template container"
dev -> cli: scaffold create
cli -> tc: init call, all answers
tc --> cli: question reply
note tc: the script stopped at a question
loop until no question is left
  cli -> tc: init call, one more answer
  tc --> cli: question reply
end
cli --> dev: project written
```

With `@step` lines the story builds up one call a step: the earlier calls fade and the new one draws itself.

```sequence
participant cli "CLI"
participant tc "template container"
@step The CLI sends an init call with every answer it holds.
cli -> tc: init call: all answers
@step The script stops at a question and sends it back.
tc --> cli: question reply
@step The next init call carries one answer more.
cli -> tc: init call: one more answer
```

## Sparkline in a sentence (`:spark[...]`)

`:spark[3,5,2,8,9]` draws a tiny line the height of the text. Add `bar` for bars and a colour word for the colour: `:spark[3,5,2,8,9 bar good]`. Hover, tap or focus it to see the numbers. A model reads `(3, 5, 2, 8, 9)`.

Sign-ups this week were :spark[120,135,128,160,182,171,205] and rising, errors fell to :spark[14,12,15,9,7,4,3 bar good], and the queue is :spark[5,4,6,22,31,18,9 warn] after Wednesday's spike.

## Stacktrace

A fence named `stacktrace`. It reads a trace as printed by Go, .NET, Bun or Node, Dart, Java or Python: the error line, each cause in its own block, threads as groups. Library frames fold into one bar; frames of your own code (`app=`) are marked, and with `repo=` and `strip=` they name the file and line at the page’s pinned commit (when its front matter has a matching pins entry). Tap a frame to open it.

```stacktrace lang=go app=example.com/shop repo=example.com/shop strip=/src/shop/ title="A Go panic"
panic: runtime error: index out of range [3] with length 3

goroutine 18 [running]:
example.com/shop/cart.(*Cart).Item(...)
	/src/shop/cart/cart.go:42
example.com/shop/api.(*Server).getItem(0xc0001a2000, {0x7f1c, 0xc000124000}, 0xc000188000)
	/src/shop/api/items.go:88 +0x1d4
net/http.HandlerFunc.ServeHTTP(0xc000010040, {0x7f1c, 0xc000124000}, 0xc000188000)
	/usr/local/go/src/net/http/server.go:2136 +0x29
net/http.serverHandler.ServeHTTP({0xc00011e000}, {0x7f1c, 0xc000124000}, 0xc000188000)
	/usr/local/go/src/net/http/server.go:2938 +0x8e
```

## Stack traces in the other five languages

`lang=` may be left out when the trace says it. Each trace below is read by its own parser.

```stacktrace app=Acme.Shop title=".NET, with an inner exception"
System.InvalidOperationException: Cart failed
 ---> System.ArgumentException: Index out of range (Parameter 'i')
   at Acme.Shop.Cart.Item(Int32 i) in /src/shop/Cart.cs:line 42
   at System.Linq.Enumerable.First[TSource](IEnumerable`1 source)
   --- End of inner exception stack trace ---
   at Acme.Shop.Api.GetItem(Int32 id) in /src/shop/Api.cs:line 88
   at Microsoft.AspNetCore.Mvc.Invoke()
```

```stacktrace app=/src/shop title="Bun or Node, with a cause"
Error: request failed
    at fetchItem (file:///src/shop/api.ts:42:11)
    at async handler (/src/shop/server.ts:10:3)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at run (/src/shop/node_modules/lib/index.js:5:9)
Caused by: TypeError: bad json
    at parse (/src/shop/util.ts:7:2)
```

```stacktrace app=shop title="Dart, with an async gap"
Unhandled exception:
Bad state: no element
#0      Cart.item (package:shop/cart.dart:42:7)
#1      Api.get (package:shop/api.dart:10:3)
<asynchronous suspension>
#2      _rootRunUnary (dart:async/zone.dart:1407:47)
#3      State.setState (package:flutter/src/widgets/framework.dart:1100:9)
```

```stacktrace app=com.acme.shop title="Java, with Caused by"
java.lang.IllegalStateException: cart failed
	at com.acme.shop.Cart.item(Cart.java:42)
	at com.acme.shop.Api.get(Api.java:88)
	at java.base/java.util.ArrayList.get(ArrayList.java:427)
	... 12 more
Caused by: java.io.IOException: boom
	at com.acme.shop.Db.read(Db.java:7)
	... 5 common frames omitted
```

```stacktrace app=/src/app title="Python, chained"
Traceback (most recent call last):
  File "/src/app/db.py", line 5, in read
    raise OSError("boom")
OSError: boom

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/src/app/main.py", line 10, in <module>
    run()
  File "/usr/lib/python3.11/site-packages/x.py", line 5, in run
    raise ValueError("bad")
ValueError: bad
```

## Stats

**Stat tiles are the row of big numbers at the top of a dashboard:** each tile is one figure with its name, how it changed and, if given, a tiny line of its recent values, so a reader takes in the state of something at a glance before reading on. The colour word in brackets says whether the change is good or bad (a fall in latency is good); it is never guessed from the sign.

```stats title="The week"
Requests "1.2 M" change=+12% [good] note="last 7 days" spark=3 5 4 6 8 9
p95 latency "180 ms" change=-8% [good] spark=9 8 8 7 7 6 5
Errors "0.4%" change=+0.1 [bad] note="of requests" spark=2 2 3 2 4 5
Cost "USD 412" change=+3% spark=4 4 5 5 5 6
```

A tile can also carry a glyph, a trend word and a sub-line. This block is `static`: it draws the tiles whole, the same in print.

```stats title="Garden at a glance" static
Yield "251 kg" glyph="✦" trend=up sub="Across three plots" change=+8% [good] note="this season" spark=180 192 205 224 251
Water "120 L" glyph="◉" trend=down sub="Stored rainwater" change=-6% [good] note="this week" spark=150 145 138 126 120
Beds "30" glyph="▦" trend=flat sub="Ready for planting" [c3]
```

## Timeline

One line per event, oldest first; an indented line is a detail. A year, a month or a day.

```timeline title="A release plan"
2026-05-04 Design review [c1]
  Scope and owners agreed
2026-09 First release [c2]
2026-11-21 Old drawing code removed [c5]
  New drawn parts take their place
2026-11-23 Version 2 ships [good] note="the big one"
```

With `dir=across` a wide screen lays it out sideways; a phone is always top to bottom. With steps, the events come in one group at a time.

```timeline title="A build-up" dir=across
2026 The idea
@step The first half of the year.
2026-03 A prototype
2026-06 A first user
@step The second half.
2026-09 First release [c2]
2026-12 Version 2 [good]
```

## Trace waterfall

A request across services. Fold spans, search, zoom the mini map, or switch to Flame.

```trace title="POST /checkout" unit=ms trace=t-7f3a
web        POST /checkout        0 842  user=u7 region=us-west-2
  gateway  route /checkout       3 838  route=checkout
    auth   verify.token          6  44  method=jwt
      db   SELECT sessions      10  38  rows=1
    cart   cart.load            47 205  items=3
      db   SELECT cart_items    52 121  rows=3
      db   SELECT prices       126 198  rows=3 cache=miss
    inventory stock.reserve     50 171  warehouse=w2
      db   UPDATE stock         57 166  rows=1 id=stock-update
    payment charge.card        208 812  provider=examplepay error="payment provider timed out"
      payment tls.connect      212 255
      payment provider.call    258 804  attempt=1 id=provider error="upstream timeout after 540 ms"
    queue  publish.retry       814 834  topic=payments.retry id=retry
@log db 130 warn "row lock held 94 ms" span=stock-update
@log payment 258 info "calling examplepay /v2/charge"
@log payment 804 error "upstream timeout after 540 ms, giving up"
@log queue 820 info "queued a retry for order o-2291"
@log web 840 error "answered 504 to the client"
@service db [c5] "Postgres"
```

:::llm
One checkout request, 842 ms, across 8 services. The payment provider call (258–804 ms) timed out, so charge.card and the request failed with a 504, and a retry was queued. Stock was reserved in parallel with the cart load and is not on the critical path; UPDATE stock in db waited 94 ms on a row lock.
:::

```trace title="GET /health" unit=ms open=2
web   GET /health        0 9
  api health.check       1 8
    db SELECT 1          2 6
```

```trace title="A flat list" unit=ms critical=off
web   GET /orders     0 60   id=a
api   orders.list     3 55   id=b parent=a
db    SELECT orders   8 40   id=c parent=b rows=25
api   orders.render  41 54   id=d parent=b
```

## Venn

Two to four sets in fixed, even shapes. It is not drawn to scale on purpose: the names are written in the regions. Hover, tap or focus a region to read its items; on a narrow screen they are listed under the figure.

```venn title="Who writes what"
set go "Go" [c1]
set rust "Rust" [c2]
set zig "Zig" [c3]
go: Ana, Ben
go & rust: Cy
go & rust & zig: Dee (writes all three)
rust: Eve, Fay
zig: 4 people
```

With steps, one set comes in at a time, with its regions.

```venn title="Adding one set at a time"
set a "Readers" [c4]
set b "Writers" [c5]
set c "Reviewers" [c6]
@step Readers and writers overlap.
a: Ana, Ben
a & b: Cy
b: Dee
@step Reviewers join; some people do all three.
c: Eve
a & b & c: Fay
```

## Video

A video part keeps the browser's video and draws its own controls: a big play button on the poster, a bar with the chapters as segments (point at it to see the chapter and a still), captions drawn by us from a WebVTT file, picture in picture and full screen. The picture here is a made-up moving gradient.

```video src="media/sample.mp4" poster="media/poster.jpg" title="Colours drifting" duration=0:12
captions: media/sample.en.vtt "English" default
thumbs: media/thumbs.vtt
chapter 0:00 Warm
chapter 0:04 Cool
chapter 0:08 Bright
0:00 The colours drift slowly across the frame.
0:04 Captions are drawn by the part from a WebVTT file.
0:08 Press C to turn them off, and F for full screen.
```

`clip` is for a short screen recording that would otherwise be a GIF: it plays muted and in a loop while it is on screen, stops when it scrolls away, and stays still when the reader asks for less motion.

```video src="media/clip.mp4" title="A short silent loop" clip height=s
```

## Wardley map

Components by evolution (left to right) and visibility (top to bottom). Positions are named keys, so the two numbers cannot be swapped.

```wardley title="A tea shop"
anchor customer "Customer" visible=0.95 evolution=0.6
component cup "Cup of tea" visible=0.8 evolution=0.6
component tea "Tea" visible=0.6 evolution=0.8
component kettle "Kettle" visible=0.45 evolution=0.4
component power "Power" visible=0.1 evolution=0.85
customer -> cup
cup -> tea
cup -> kettle
kettle -> power
note "Kettles are a product now" visible=0.3 evolution=0.1
@step Today the kettle is a product we buy.
highlight kettle
@step A smart kettle moves it further to the right.
evolve kettle 0.65 "smart kettle"
```

## Weather

A forecast written in the source; it never fetches. The units menu on the part switches °C and °F, km/h, mph, m/s and knots, mm and inches, hPa and inHg, and your choice is remembered in this browser.

```weather place="San Francisco" unit=c tz=America/Los_Angeles
2026-11-22 sun 18/11 rain=0% wind=12km/h pressure=1021hPa
2026-11-23 partly 16/10 rain=10% wind=15km/h pressure=1018hPa
2026-11-24 rain 14/9 rain=80% wind=30km/h precip=6mm pressure=1004hPa
2026-11-25 storm 13/8 rain=95% wind=45km/h precip=14mm pressure=996hPa note="Ferry may stop"
2026-11-26 cloud 12/7 rain=30% wind=20km/h precip=1mm pressure=1009hPa
```

Hours work the same way, with one temperature, here written in °F and mph.

```weather place="Oakland" unit=f wind=mph tz=America/Los_Angeles
2026-11-24 06:00 fog 48 rain=5% wind=4mph
2026-11-24 09:00 cloud 52 rain=20% wind=8mph
2026-11-24 12:00 drizzle 57 rain=60% wind=11mph
2026-11-24 15:00 rain 59 rain=85% wind=14mph
2026-11-24 18:00 rain 55 rain=70% wind=12mph
2026-11-24 21:00 cloud 51 rain=25% wind=7mph
```

The same forecast with `static`: drawn whole in the fence's unit, with no menu.

```weather static place="Sydney" unit=c wind=kmh
2026-11-22 sun 24/17 rain=0% wind=14km/h
2026-11-23 partly 22/16 rain=20% wind=18km/h
2026-11-24 sleet 3/-1 rain=70% wind=22km/h note="Ice on the road"
```
````
:::

LLM view
---
title: "DurianMarkdown: every syntax on one page"
description: Every public sample of the package (v0.7.0-rc.3), 111 in all, each with its source under it.
marks:
  deprecated:
    label: deprecated
    colour: warn
    means: still works, but will be removed
  experimental:
    label: experimental
    colour: c3
    means: may change without notice
prefixes:
  ">>>":
    label: Python
    colour: c4
    means: a line typed at the Python prompt
source: every-syntax.dh.md
---
<!-- Made by dh llm from the source; nobody edits this file. -->

Every public sample of the package on one page: 111 samples in four groups. Open "Source" under any sample to see what was written.
# Text, blocks and parts

# Fishbone — find the causes

Group possible causes around one effect, then reveal the next finding. Try the step controls, or compare the finished static drawing below. The theme buttons apply to both.

Fishbone: Why is checkout slow? Effect: Checkout takes 4 seconds at p95. Causes by category:
- Tools
  - the ORM loads every line item
    - one query per line
- Process
  - no load test before a release
- Environment
  - the database is in another region
- People
  - on-call is new to the service

Steps:
1. Start with the service
2. Check the surroundings

## The same diagram, ready to print

Fishbone: Why is checkout slow? Effect: Checkout takes 4 seconds at p95. Causes by category:
- Tools
  - the ORM loads every line item
    - one query per line
- Process
  - no load test before a release
- Environment
  - the database is in another region
- People
  - on-call is new to the service

#### Source: `fixtures/format/00-fishbone.dh.md`

````text
---
title: Fishbone — find the causes
---

# Fishbone — find the causes

Group possible causes around one effect, then reveal the next finding. Try the step controls, or compare the finished static drawing below. The theme buttons apply to both.

```fishbone title="Why is checkout slow?"
effect: Checkout takes 4 seconds at p95
@step Start with the service
Tools: the ORM loads every line item
  one query per line
Process: no load test before a release
@step Check the surroundings
Environment: the database is in another region
People: on-call is new to the service
highlight Tools
```

## The same diagram, ready to print

```fishbone static title="Why is checkout slow?"
effect: Checkout takes 4 seconds at p95
Tools: the ORM loads every line item
  one query per line
Process: no load test before a release
Environment: the database is in another region
People: on-call is new to the service
highlight Tools
```
````

# Sankey — follow the flow

Follow a request's time through the service. Band widths show milliseconds; hover, focus or tap a band to read its share. Full labels stay on plates in either theme.

Sankey: Where a request's time goes (ms).

Step 1: Enter the service

| from | to | amount (ms) |
| --- | --- | --- |
| Incoming request | Authentication | 12 |
| Incoming request | Application processing | 80 |

Step 2: Follow the work

| from | to | amount (ms) |
| --- | --- | --- |
| Application processing | Database queries | 55 |
| Application processing | Response assembly | 20 |
| Application processing | Cache lookup | 5 |

## The same flow, ready to print

Sankey: Where a request's time goes (ms).

| from | to | amount (ms) |
| --- | --- | --- |
| Incoming request | Authentication | 12 |
| Incoming request | Application processing | 80 |
| Application processing | Database queries | 55 |
| Application processing | Response assembly | 20 |
| Application processing | Cache lookup | 5 |

#### Source: `fixtures/format/00-sankey.dh.md`

````text
---
title: Sankey — follow the flow
---

# Sankey — follow the flow

Follow a request's time through the service. Band widths show milliseconds; hover, focus or tap a band to read its share. Full labels stay on plates in either theme.

```sankey title="Where a request's time goes" unit=ms
request -> auth: 12
request -> handler: 80
node request "Incoming request" [c1]
node auth "Authentication" [c2]
node handler "Application processing" [c3]
node db "Database queries" [c4]
node render "Response assembly" [c5]
node cache "Cache lookup" [c6]
@step Enter the service
@step Follow the work
handler -> db: 55
handler -> render: 20
handler -> cache: 5
```

## The same flow, ready to print

```sankey static title="Where a request's time goes" unit=ms
request -> auth: 12
request -> handler: 80
handler -> db: 55
handler -> render: 20
handler -> cache: 5
node request "Incoming request" [c1]
node auth "Authentication" [c2]
node handler "Application processing" [c3]
node db "Database queries" [c4]
node render "Response assembly" [c5]
node cache "Cache lookup" [c6]
```
````

## Callouts

A callout is a note beside the text it is about. A note about the whole page is a callout too: put it under the title. It is a blockquote that opens with a bold marker. The marker picks the icon and the colour; the author never picks an icon.

> **Note:** a fact worth knowing, but not needed to follow the text.

> **Tip:** press Ctrl+K to search the docs.

> **Important:** the CLI sends every answer on every call.

> **Watch out:** a validate call replays the script with the deterministic state from before the question.

> **Security finding:** (an example, not a real finding) a security block sits on its own; the public LLM view drops it.

#### Source: `fixtures/format/01-callouts.dh.md`

````text
---
title: "Callouts"
description: A fixture made from the Format page section of the same name.
---

## Callouts

A callout is a note beside the text it is about. A note about the whole page is a callout too: put it under the title. It is a blockquote that opens with a bold marker. The marker picks the icon and the colour; the author never picks an icon.

> **Note:** a fact worth knowing, but not needed to follow the text.

> **Tip:** press :kbd[Ctrl+K] to search the docs.

> **Important:** the CLI sends every answer on every call.

> **Watch out:** a validate call replays the script with the deterministic state from before the question.

> **Security finding:** (an example, not a real finding) a security block sits on its own; the public LLM view drops it.
````

## Keyboard keys

One key Esc, a combination Ctrl+Shift+P, and a sequence Ctrl+K, then Ctrl+S: press the first, let go, then press the second.
Arrow keys are written by name: Left arrow and Right arrow step through a stage; the page draws the arrows.

#### Source: `fixtures/format/02-keyboard-keys.dh.md`

````text
---
title: "Keyboard keys"
description: A fixture made from the Format page section of the same name.
---

## Keyboard keys

One key :kbd[Esc], a combination :kbd[Ctrl+Shift+P], and a sequence :kbd[Ctrl+K, Ctrl+S]: press the first, let go, then press the second.
Arrow keys are written by name: :kbd[Left] and :kbd[Right] step through a stage; the page draws the arrows.
````

## Mouse actions

One mouse icon and the action. The button the action presses is filled: the left one for a click, the right one for a right click, the wheel for a middle click. A double click adds a "2", so it never looks like a single click. Scroll adds arrows by the wheel; drag, drop, hover and select add their own small mark.

- click Next
- double-click index.ts
- right-click src/
- middle-click the tab
- scroll the list
- drag README.md
- drop it on docs/
- hover the chip
- select the first line

#### Source: `fixtures/format/03-mouse-actions.dh.md`

````text
---
title: "Mouse actions"
description: A fixture made from the Format page section of the same name.
---

## Mouse actions

One mouse icon and the action. The button the action presses is filled: the left one for a click, the right one for a right click, the wheel for a middle click. A double click adds a "2", so it never looks like a single click. Scroll adds arrows by the wheel; drag, drop, hover and select add their own small mark.

- :mouse[click Next]
- :mouse[double-click index.ts]
- :mouse[right-click src/]
- :mouse[middle-click the tab]
- :mouse[scroll the list]
- :mouse[drag README.md]
- :mouse[drop it on docs/]
- :mouse[hover the chip]
- :mouse[select the first line]
````

## Table of contents

The page form lists the page's headings; `depth` says how deep it goes.

#### Source: `fixtures/format/04-table-of-contents.dh.md`

````text
---
title: "Table of contents"
description: A fixture made from the Format page section of the same name.
---

## Table of contents

The page form lists the page's headings; `depth` says how deep it goes.

::toc{depth=2}
````

## Tabs

Each heading inside `:::tabs` starts one tab. An LLM reads the headings and the text under them.

#### Node

Install with `npm i @example/scaffold-sdk`.

#### Python

Install with `pip install scaffold-sdk`.

#### Source: `fixtures/format/05-tabs.dh.md`

````text
---
title: "Tabs"
description: A fixture made from the Format page section of the same name.
---

## Tabs

Each heading inside `:::tabs` starts one tab. An LLM reads the headings and the text under them.

:::tabs
#### Node
Install with `npm i @example/scaffold-sdk`.
#### Python
Install with `pip install scaffold-sdk`.
:::
````

## Accordion

Each heading inside `:::accordion` starts one row that opens and closes.

#### Why replay instead of pausing?

A paused script would tie one template container to each person who is answering.

#### What does a replay cost?

Each call runs the script again from its first line.

#### Source: `fixtures/format/06-accordion.dh.md`

````text
---
title: "Accordion"
description: A fixture made from the Format page section of the same name.
---

## Accordion

Each heading inside `:::accordion` starts one row that opens and closes.

:::accordion
#### Why replay instead of pausing?
A paused script would tie one template container to each person who is answering.
#### What does a replay cost?
Each call runs the script again from its first line.
:::
````

## Human-only segment

A segment for people only. The `:::llm` block right after it is what an LLM reads instead.

The person talks to the CLI, which calls the template container.

#### Source: `fixtures/format/07-human-only-segment.dh.md`

````text
---
title: "Human-only segment"
description: A fixture made from the Format page section of the same name.
---

## Human-only segment

A segment for people only. The `:::llm` block right after it is what an LLM reads instead.

:::human
This segment is long on purpose: it walks a new reader through the idea, slowly, with a picture.

```animation
person p "person"
box c "CLI"
box t "template container"
p -> c "talks to"
c -> t "calls"
```
:::

:::llm
The person talks to the CLI, which calls the template container.
:::
````

## A segment LLMs skip

`llm=none` says, in the source, that LLMs need nothing here.

#### Source: `fixtures/format/08-a-segment-llms-skip.dh.md`

````text
---
title: "A segment LLMs skip"
description: A fixture made from the Format page section of the same name.
---

## A segment LLMs skip

`llm=none` says, in the source, that LLMs need nothing here.

:::human llm=none
Use :kbd[Left] and :kbd[Right] to step through a stage.
:::
````

## Still scene

Boxes joined by lines are an `animation`. With no `@step` line it stands still: drawn once, with no player. An LLM reads what it starts with and what is connected.

Starts with: box cli "CLI"; box tc "template container"; box out "project folder". Connected: cli -> tc "init call", tc -> out "writes the files".

#### Source: `fixtures/format/09-still-scene.dh.md`

````text
---
title: "Still scene"
description: A fixture made from the Format page section of the same name.
---

## Still scene

Boxes joined by lines are an `animation`. With no `@step` line it stands still: drawn once, with no player. An LLM reads what it starts with and what is connected.

```animation
box cli "CLI"
box tc "template container"
cli -> tc "init call"
box out "project folder"
tc -> out "writes the files"
```
````

## Steps on any part

Steps are not a part of their own: any part becomes step by step when it holds `@step` lines. Here a sequence builds up one call a step.

Sequence. Participants: CLI, template container.

The CLI sends an init call with every answer it holds.
1. cli -> tc: init call: all answers
The script stops at a question and sends it back.
2. tc --> cli: question reply
The next init call carries one answer more.
3. cli -> tc: init call: one more answer

#### Source: `fixtures/format/10-steps-on-any-part.dh.md`

````text
---
title: "Steps on any part"
description: A fixture made from the Format page section of the same name.
---

## Steps on any part

Steps are not a part of their own: any part becomes step by step when it holds `@step` lines. Here a sequence builds up one call a step.

```sequence
participant cli "CLI"
participant tc "template container"
@step The CLI sends an init call with every answer it holds.
cli -> tc: init call: all answers
@step The script stops at a question and sends it back.
tc --> cli: question reply
@step The next init call carries one answer more.
cli -> tc: init call: one more answer
```
````

## Chart: bar

An LLM reads a chart's data as a table.

Chart (bar): Answers carried by each init call

| init call | answers |
| --- | --- |
| 1 | 0 |
| 2 | 1 |
| 3 | 2 |
| 4 | 3 |
| 5 | 4 |

#### Source: `fixtures/format/11-chart-bar.dh.md`

````text
---
title: "Chart: bar"
description: A fixture made from the Format page section of the same name.
---

## Chart: bar

An LLM reads a chart's data as a table.

```chart
kind: bar
title: Answers carried by each init call
x: { label: init call, values: [1, 2, 3, 4, 5] }
y: { label: answers }
series:
  - name: answers
    data: [0, 1, 2, 3, 4]
```
````

## Chart: grouped bars

Several series side by side is the default for bars.

Chart (bar): Runs per create, by number of questions

| questions | init calls | validate calls | both |
| --- | --- | --- | --- |
| 2 | 3 | 2 | 5 |
| 4 | 5 | 4 | 9 |
| 6 | 7 | 6 | 13 |

#### Source: `fixtures/format/12-chart-grouped-bars.dh.md`

````text
---
title: "Chart: grouped bars"
description: A fixture made from the Format page section of the same name.
---

## Chart: grouped bars

Several series side by side is the default for bars.

```chart
kind: bar
title: Runs per create, by number of questions
x: { label: questions, values: [2, 4, 6] }
y: { label: runs }
series:
  - name: init calls
    data: [3, 5, 7]
  - name: validate calls
    data: [2, 4, 6]
  - name: both
    data: [5, 9, 13]
```
````

## Chart: stacked bar

Chart (stacked bar): Size of each init call, in bytes

| init call | answers | deterministic state |
| --- | --- | --- |
| 1 | 0 | 0 |
| 2 | 48 | 40 |
| 3 | 96 | 40 |
| 4 | 144 | 40 |

#### Source: `fixtures/format/13-chart-stacked-bar.dh.md`

````text
---
title: "Chart: stacked bar"
description: A fixture made from the Format page section of the same name.
---

## Chart: stacked bar

```chart
kind: bar
stacked: true
title: Size of each init call, in bytes
x: { label: init call, values: [1, 2, 3, 4] }
y: { label: bytes }
series:
  - name: answers
    data: [0, 48, 96, 144]
  - name: deterministic state
    data: [0, 40, 40, 40]
```
````

## Chart: 100% stacked bar

`stacked: percent` scales each bar to 100%; the tooltip still shows the real number. Init call 1 carries nothing, so it has no share and is left out.

Chart (100% stacked bar): Share of each init call's size

Each bar or area is scaled to 100%; the cells hold the real values.

| init call | answers | deterministic state |
| --- | --- | --- |
| 2 | 48 | 40 |
| 3 | 96 | 40 |
| 4 | 144 | 40 |

#### Source: `fixtures/format/14-chart-100-stacked-bar.dh.md`

````text
---
title: "Chart: 100% stacked bar"
description: A fixture made from the Format page section of the same name.
---

## Chart: 100% stacked bar

`stacked: percent` scales each bar to 100%; the tooltip still shows the real number. Init call 1 carries nothing, so it has no share and is left out.

```chart
kind: bar
stacked: percent
title: Share of each init call's size
x: { label: init call, values: [2, 3, 4] }
y: { label: share of bytes }
series:
  - name: answers
    data: [48, 96, 144]
  - name: deterministic state
    data: [40, 40, 40]
```
````

## Chart: horizontal bar

`horizontal: true` turns the bars on their side; long names get room.

Chart (bar): Time to create, by way of working

The bars run horizontally.

| way | seconds |
| --- | --- |
| Edit files by hand | 95 |
| Run the template once | 12 |
| Ask every question | 31 |
| Replay all answers | 48 |

#### Source: `fixtures/format/15-chart-horizontal-bar.dh.md`

````text
---
title: "Chart: horizontal bar"
description: A fixture made from the Format page section of the same name.
---

## Chart: horizontal bar

`horizontal: true` turns the bars on their side; long names get room.

```chart
kind: bar
horizontal: true
title: Time to create, by way of working
x: { label: way, values: [Edit files by hand, Run the template once, Ask every question, Replay all answers] }
y: { label: seconds }
series:
  - name: seconds
    data: [95, 12, 31, 48]
```
````

## Chart: floating bars

A value written `[low, high]` floats the bar between the two. The LLM table reads it as "3 to 9".

Chart (bar): Time each step takes, in seconds

A cell "a to b" is a floating bar from a to b.

| step | range |
| --- | --- |
| Ask | 0 to 4 |
| Validate | 4 to 9 |
| Generate | 9 to 21 |
| Write | 21 to 26 |

#### Source: `fixtures/format/16-chart-floating-bars.dh.md`

````text
---
title: "Chart: floating bars"
description: A fixture made from the Format page section of the same name.
---

## Chart: floating bars

A value written `[low, high]` floats the bar between the two. The LLM table reads it as "3 to 9".

```chart
kind: bar
title: Time each step takes, in seconds
x: { label: step, values: [Ask, Validate, Generate, Write] }
y: { label: seconds }
series:
  - name: range
    data: [[0, 4], [4, 9], [9, 21], [21, 26]]
```
````

## Chart: line

Chart (line): Script runs per create, by number of questions

| questions | init calls | with one validate call per question |
| --- | --- | --- |
| 1 | 2 | 3 |
| 2 | 3 | 5 |
| 3 | 4 | 7 |
| 4 | 5 | 9 |
| 5 | 6 | 11 |
| 6 | 7 | 13 |

#### Source: `fixtures/format/17-chart-line.dh.md`

````text
---
title: "Chart: line"
description: A fixture made from the Format page section of the same name.
---

## Chart: line

```chart
kind: line
title: Script runs per create, by number of questions
x: { label: questions, values: [1, 2, 3, 4, 5, 6] }
y: { label: runs }
series:
  - name: init calls
    data: [2, 3, 4, 5, 6, 7]
  - name: with one validate call per question
    data: [3, 5, 7, 9, 11, 13]
```
````

## Chart: area

Chart (area): Answers sent in all, after each init call

| init call | answers sent |
| --- | --- |
| 1 | 0 |
| 2 | 1 |
| 3 | 3 |
| 4 | 6 |
| 5 | 10 |
| 6 | 15 |

#### Source: `fixtures/format/18-chart-area.dh.md`

````text
---
title: "Chart: area"
description: A fixture made from the Format page section of the same name.
---

## Chart: area

```chart
kind: area
title: Answers sent in all, after each init call
x: { label: init call, values: [1, 2, 3, 4, 5, 6] }
y: { label: answers sent so far }
series:
  - name: answers sent
    data: [0, 1, 3, 6, 10, 15]
```
````

## Chart: stacked area

Chart (stacked area): Calls sent so far, by kind

| init call | init calls | validate calls |
| --- | --- | --- |
| 1 | 1 | 0 |
| 2 | 2 | 1 |
| 3 | 3 | 2 |
| 4 | 4 | 3 |
| 5 | 5 | 4 |

#### Source: `fixtures/format/19-chart-stacked-area.dh.md`

````text
---
title: "Chart: stacked area"
description: A fixture made from the Format page section of the same name.
---

## Chart: stacked area

```chart
kind: area
stacked: true
title: Calls sent so far, by kind
x: { label: init call, values: [1, 2, 3, 4, 5] }
y: { label: calls }
series:
  - name: init calls
    data: [1, 2, 3, 4, 5]
  - name: validate calls
    data: [0, 1, 2, 3, 4]
```
````

## Chart: mixed bars and line, two axes

A series can have its own `kind`, and `axis: y2` puts it on a second axis on the right. The chart declares that axis with `y2`.

Chart (bar + line): Runs and time, by number of questions

Bars: runs. Lines: time. Right axis (y2: seconds): time. Left axis (runs): runs.

| questions | runs | time |
| --- | --- | --- |
| 1 | 2 | 4 |
| 2 | 3 | 7 |
| 3 | 4 | 11 |
| 4 | 5 | 16 |
| 5 | 6 | 22 |

#### Source: `fixtures/format/20-chart-mixed-bars-and-line-two-axes.dh.md`

````text
---
title: "Chart: mixed bars and line, two axes"
description: A fixture made from the Format page section of the same name.
---

## Chart: mixed bars and line, two axes

A series can have its own `kind`, and `axis: y2` puts it on a second axis on the right. The chart declares that axis with `y2`.

```chart
kind: bar
title: Runs and time, by number of questions
x: { label: questions, values: [1, 2, 3, 4, 5] }
y: { label: runs }
y2: { label: seconds, min: 0 }
series:
  - name: runs
    data: [2, 3, 4, 5, 6]
  - name: time
    kind: line
    axis: y2
    tone: 5
    data: [4, 7, 11, 16, 22]
```
````

## Chart: log scale

`scale: log` on an axis spaces the ticks by powers of ten. It needs values above 0.

Chart (line): Size of the answer set, by number of questions

Log scale on y.

| questions | answer sets |
| --- | --- |
| 1 | 3 |
| 2 | 9 |
| 3 | 27 |
| 4 | 81 |
| 5 | 243 |
| 6 | 729 |

#### Source: `fixtures/format/21-chart-log-scale.dh.md`

````text
---
title: "Chart: log scale"
description: A fixture made from the Format page section of the same name.
---

## Chart: log scale

`scale: log` on an axis spaces the ticks by powers of ten. It needs values above 0.

```chart
kind: line
title: Size of the answer set, by number of questions
x: { label: questions, values: [1, 2, 3, 4, 5, 6] }
y: { label: possible answer sets, scale: log }
series:
  - name: answer sets
    data: [3, 9, 27, 81, 243, 729]
```
````

## Chart: scatter

Chart (scatter): Body size against answers carried

| series | answers | bytes |
| --- | --- | --- |
| init calls | 0 | 40 |
| init calls | 1 | 92 |
| init calls | 2 | 139 |
| init calls | 3 | 190 |
| init calls | 4 | 236 |
| init calls | 5 | 288 |

#### Source: `fixtures/format/22-chart-scatter.dh.md`

````text
---
title: "Chart: scatter"
description: A fixture made from the Format page section of the same name.
---

## Chart: scatter

```chart
kind: scatter
title: Body size against answers carried
x: { label: answers }
y: { label: bytes }
series:
  - name: init calls
    data: [[0, 40], [1, 92], [2, 139], [3, 190], [4, 236], [5, 288]]
```
````

## Chart: scatter on log scales

Both axes of a scatter chart can be log.

Chart (scatter): Run time against input size

Log scale on x and y.

| series | questions | milliseconds |
| --- | --- | --- |
| runs | 1 | 12 |
| runs | 3 | 35 |
| runs | 10 | 120 |
| runs | 30 | 340 |
| runs | 100 | 1200 |
| runs | 300 | 3500 |

#### Source: `fixtures/format/23-chart-scatter-on-log-scales.dh.md`

````text
---
title: "Chart: scatter on log scales"
description: A fixture made from the Format page section of the same name.
---

## Chart: scatter on log scales

Both axes of a scatter chart can be log.

```chart
kind: scatter
title: Run time against input size
x: { label: questions, scale: log }
y: { label: milliseconds, scale: log }
series:
  - name: runs
    data: [[1, 12], [3, 35], [10, 120], [30, 340], [100, 1200], [300, 3500]]
```
````

## Chart: bubble

A bubble point is `[x, y, size]`; the area of the bubble follows the size.

Chart (bubble): Templates by questions, run time and downloads

Size is the size of the bubble.

| series | questions | seconds | size |
| --- | --- | --- | --- |
| templates | 3 | 8 | 120 |
| templates | 6 | 14 | 480 |
| templates | 9 | 30 | 60 |
| templates | 12 | 41 | 900 |
| templates | 15 | 52 | 240 |

#### Source: `fixtures/format/24-chart-bubble.dh.md`

````text
---
title: "Chart: bubble"
description: A fixture made from the Format page section of the same name.
---

## Chart: bubble

A bubble point is `[x, y, size]`; the area of the bubble follows the size.

```chart
kind: bubble
title: Templates by questions, run time and downloads
x: { label: questions }
y: { label: seconds }
series:
  - name: templates
    data: [[3, 8, 120], [6, 14, 480], [9, 30, 60], [12, 41, 900], [15, 52, 240]]
```
````

## Chart: candlestick

A candlestick chart draws one candle per period. Its series has no `kind`, and each value is four numbers, `[open, high, low, close]`. The body runs from the open to the close and the thin line (the wick) from the low to the high. A candle that closes at or above its open is up (green, light body); one that closes below is down (pink, solid body). Hover or tap a candle to read all four numbers.

Chart (candlestick): One week of a share price

Each row is one candle: the value at the open, the highest and lowest values reached, and the value at the close; up means the close is at or above the open.

| day | open | high | low | close |
| --- | --- | --- | --- | --- |
| Mon | 100 | 108 | 98 | 105 |
| Tue | 105 | 110 | 101 | 102 |
| Wed | 102 | 104 | 95 | 96 |
| Thu | 96 | 103 | 94 | 101 |
| Fri | 101 | 109 | 100 | 108 |

#### Source: `fixtures/format/25-chart-candlestick.dh.md`

````text
---
title: "Chart: candlestick"
description: A fixture made from the Format page section of the same name.
---

## Chart: candlestick

A candlestick chart draws one candle per period. Its series has no `kind`, and each value is four numbers, `[open, high, low, close]`. The body runs from the open to the close and the thin line (the wick) from the low to the high. A candle that closes at or above its open is up (green, light body); one that closes below is down (pink, solid body). Hover or tap a candle to read all four numbers.

```chart
kind: candlestick
title: One week of a share price
x: { label: day, values: [Mon, Tue, Wed, Thu, Fri] }
y: { label: price, min: 90 }
series:
  - name: price
    data: [[100, 108, 98, 105], [105, 110, 101, 102], [102, 104, 95, 96], [96, 103, 94, 101], [101, 109, 100, 108]]
```
````

## Chart: candlestick with a moving average

Another series with `kind: line` draws on top of the candles: here the average of the last three closing prices. It may use `y2` for a second axis, like any other chart.

Chart (candlestick): Two weeks of a share price, with its 3-day average

Each row is one candle: the value at the open, the highest and lowest values reached, and the value at the close; up means the close is at or above the open. The other columns are lines drawn over the candles.

| day | open | high | low | close | 3-day average |
| --- | --- | --- | --- | --- | --- |
| 1 | 100 | 106 | 98 | 104 |  |
| 2 | 104 | 109 | 102 | 107 |  |
| 3 | 107 | 111 | 105 | 106 | 105.7 |
| 4 | 106 | 108 | 101 | 102 | 105 |
| 5 | 102 | 105 | 97 | 99 | 102.3 |
| 6 | 99 | 104 | 96 | 103 | 101.3 |
| 7 | 103 | 110 | 102 | 109 | 103.7 |
| 8 | 109 | 113 | 107 | 112 | 108 |
| 9 | 112 | 114 | 108 | 109 | 110 |
| 10 | 109 | 112 | 106 | 111 | 110.7 |

#### Source: `fixtures/format/26-chart-candlestick-with-a-moving-average.dh.md`

````text
---
title: "Chart: candlestick with a moving average"
description: A fixture made from the Format page section of the same name.
---

## Chart: candlestick with a moving average

Another series with `kind: line` draws on top of the candles: here the average of the last three closing prices. It may use `y2` for a second axis, like any other chart.

```chart
kind: candlestick
title: Two weeks of a share price, with its 3-day average
x: { label: day, values: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] }
y: { label: price, min: 90 }
series:
  - name: price
    data: [[100, 106, 98, 104], [104, 109, 102, 107], [107, 111, 105, 106], [106, 108, 101, 102], [102, 105, 97, 99], [99, 104, 96, 103], [103, 110, 102, 109], [109, 113, 107, 112], [112, 114, 108, 109], [109, 112, 106, 111]]
  - name: 3-day average
    kind: line
    tone: 6
    data: [null, null, 105.7, 105, 102.3, 101.3, 103.7, 108, 110, 110.7]
```
````

## Chart: radar

The x list names the axes (at least three); each series is one outline.

Chart (radar): Two ways of replaying answers

| axis | Replay all answers | Keep a session |
| --- | --- | --- |
| Speed | 3 | 5 |
| Safety | 5 | 2 |
| Size | 2 | 4 |
| Clarity | 4 | 3 |
| Cost | 4 | 2 |

#### Source: `fixtures/format/27-chart-radar.dh.md`

````text
---
title: "Chart: radar"
description: A fixture made from the Format page section of the same name.
---

## Chart: radar

The x list names the axes (at least three); each series is one outline.

```chart
kind: radar
title: Two ways of replaying answers
x: [Speed, Safety, Size, Clarity, Cost]
series:
  - name: Replay all answers
    data: [3, 5, 2, 4, 4]
  - name: Keep a session
    data: [5, 2, 4, 3, 2]
```
````

## Chart: pie

Chart (pie): Time in one create

| part | seconds |
| --- | --- |
| Ask | 4 |
| Validate | 5 |
| Generate | 12 |
| Write | 5 |

#### Source: `fixtures/format/28-chart-pie.dh.md`

````text
---
title: "Chart: pie"
description: A fixture made from the Format page section of the same name.
---

## Chart: pie

```chart
kind: pie
title: Time in one create
x: { values: [Ask, Validate, Generate, Write] }
series:
  - name: seconds
    data: [4, 5, 12, 5]
```
````

## Chart: doughnut

Chart (doughnut): Where the script's runs go, for 3 questions

| part | runs |
| --- | --- |
| init calls | 4 |
| validate calls | 2 |

#### Source: `fixtures/format/29-chart-doughnut.dh.md`

````text
---
title: "Chart: doughnut"
description: A fixture made from the Format page section of the same name.
---

## Chart: doughnut

```chart
kind: doughnut
title: Where the script's runs go, for 3 questions
x: { values: [init calls, validate calls] }
series:
  - name: runs
    data: [4, 2]
```
````

## Chart: polar area

Like a pie, but every slice has the same angle and its value is the length.

Chart (polar): Calls by hour of the day

| part | calls |
| --- | --- |
| Morning | 34 |
| Noon | 52 |
| Afternoon | 61 |
| Evening | 28 |
| Night | 9 |

#### Source: `fixtures/format/30-chart-polar-area.dh.md`

````text
---
title: "Chart: polar area"
description: A fixture made from the Format page section of the same name.
---

## Chart: polar area

Like a pie, but every slice has the same angle and its value is the length.

```chart
kind: polar
title: Calls by hour of the day
x: { values: [Morning, Noon, Afternoon, Evening, Night] }
series:
  - name: calls
    data: [34, 52, 61, 28, 9]
```
````

## Chart with controls

The reader moves the slider or picks a view; the chart redraws from its formulas. A chart with formulas goes to an LLM as its source, since the formulas say more than one set of numbers.

```chart
kind: bar
title: Answers carried by each init call
controls:
  - slider: questions
    label: Questions in the script
    min: 1
    max: 20
    value: 6
  - select: view
    label: Show
    options: [per call, running total]
let:
  calls: range(1, questions + 1)
  carried: calls - 1
x: calls
y: { label: answers }
series:
  - name: answers
    data: "view == 'per call' ? carried : cumsum(carried)"
```

#### Source: `fixtures/format/31-chart-with-controls.dh.md`

````text
---
title: "Chart with controls"
description: A fixture made from the Format page section of the same name.
---

## Chart with controls

The reader moves the slider or picks a view; the chart redraws from its formulas. A chart with formulas goes to an LLM as its source, since the formulas say more than one set of numbers.

```chart
kind: bar
title: Answers carried by each init call
controls:
  - slider: questions
    label: Questions in the script
    min: 1
    max: 20
    value: 6
  - select: view
    label: Show
    options: [per call, running total]
let:
  calls: range(1, questions + 1)
  carried: calls - 1
x: calls
y: { label: answers }
series:
  - name: answers
    data: "view == 'per call' ? carried : cumsum(carried)"
```
````

## Tier list

A tier list ranks items in rows, best first. Write one line per tier: its name, a colon, then its items with commas between them. A short note goes in brackets after an item; the page shows it when a reader taps or hovers the item. An LLM reads the same lines.

Tier list: Databases for a small team (top tier first)
S: Postgres (does almost everything), SQLite (no server to run)
A: MySQL, "Redis, as a cache" (fast, but memory is dear)
B: MongoDB, DynamoDB
C: Cassandra (great at scale, hard to run small)
D: A spreadsheet

#### Source: `fixtures/format/32-tier-list.dh.md`

````text
---
title: "Tier list"
description: A fixture made from the Format page section of the same name.
---

## Tier list

A tier list ranks items in rows, best first. Write one line per tier: its name, a colon, then its items with commas between them. A short note goes in brackets after an item; the page shows it when a reader taps or hovers the item. An LLM reads the same lines.

```tierlist title="Databases for a small team"
S: Postgres (does almost everything), SQLite (no server to run)
A: MySQL, "Redis, as a cache" (fast, but memory is dear)
B: MongoDB, DynamoDB
C: Cassandra (great at scale, hard to run small)
D: A spreadsheet
```
````

## Tier list: your own tiers

The tiers are S, A, B, C and D unless you say otherwise. **A list may have any tiers, in any number.** Start with a line `tiers:` that names them; a name may be followed by a colour in square brackets (`c1` to `c8`, `good`, `warn` or `bad`). The tier lines use those names; a tier with no line is an empty row. This list has four tiers.

Tier list: What the first release needs (top tier first)
Must: Sign in, Pay by card (one provider)
Should: Email receipts, A dark theme
Could: Gift cards (needs a legal check)
Won't: A mobile app

#### Source: `fixtures/format/33-tier-list-your-own-tiers.dh.md`

````text
---
title: "Tier list: your own tiers"
description: A fixture made from the Format page section of the same name.
---

## Tier list: your own tiers

The tiers are S, A, B, C and D unless you say otherwise. **A list may have any tiers, in any number.** Start with a line `tiers:` that names them; a name may be followed by a colour in square brackets (`c1` to `c8`, `good`, `warn` or `bad`). The tier lines use those names; a tier with no line is an empty row. This list has four tiers.

```tierlist title="What the first release needs"
tiers: Must [good], Should [c6], Could [c3], Won't [bad]
Must: Sign in, Pay by card (one provider)
Should: Email receipts, A dark theme
Could: Gift cards (needs a legal check)
Won't: A mobile app
```
````

## Tier list: three tiers, or seven

There is no limit of four or five. Three tiers are enough for a short list; seven fit a scale with many steps. Only the names on the `tiers:` line count.

Tier list: Is it worth doing? (top tier first)
Yes: Cache the build, Add a sample
Maybe: Rewrite the docs site (a lot of work)
No: Support every browser ever

Tier list: How far along is each part? (top tier first)
Shipped: Terminal, File tree
Beta: Editor
Alpha: Animation in 3D
Prototype: Tier list
Sketch: Voice over
Idea: A map part
Dropped: A clock part

#### Source: `fixtures/format/34-tier-list-three-tiers-or-seven.dh.md`

````text
---
title: "Tier list: three tiers, or seven"
description: A fixture made from the Format page section of the same name.
---

## Tier list: three tiers, or seven

There is no limit of four or five. Three tiers are enough for a short list; seven fit a scale with many steps. Only the names on the `tiers:` line count.

```tierlist title="Is it worth doing?"
tiers: Yes [good], Maybe [warn], No [bad]
Yes: Cache the build, Add a sample
Maybe: Rewrite the docs site (a lot of work)
No: Support every browser ever
```

```tierlist title="How far along is each part?"
tiers: Shipped [good], Beta [c6], Alpha [c4], Prototype [c3], Sketch [c5], Idea [c7], Dropped [bad]
Shipped: Terminal, File tree
Beta: Editor
Alpha: Animation in 3D
Prototype: Tier list
Sketch: Voice over
Idea: A map part
Dropped: A clock part
```
````

## Alignment grid

An alignment grid has two axes, each with a name at both ends and any names between (the classic one is lawful .. chaotic by good .. evil). The first name is the left (or top) end. Put items in a cell by its column and row names, `column / row: item, item`; a `"label"` before the colon names the cell.

Alignment grid: Which kind of hero? Columns (x, left to right): lawful, neutral, chaotic. Rows (y, top to bottom): good, neutral, evil.

| cell | items |
| --- | --- |
| lawful / good "Crusader" | Paladin (keeps every oath), Cleric |
| neutral / good | Druid (looks after the land) |
| chaotic / good "Rebel" | Bard (helps, breaks the rules) |
| neutral / neutral "Balance" | Monk |
| lawful / evil "Tyrant" | Warlock (a contract for everything) |
| chaotic / evil "Raider" | Rogue (takes what it wants) |

Cells not listed are empty.

#### Source: `fixtures/format/35-alignment-grid.dh.md`

````text
---
title: "Alignment grid"
description: A fixture made from the Format page section of the same name.
---

## Alignment grid

An alignment grid has two axes, each with a name at both ends and any names between (the classic one is lawful .. chaotic by good .. evil). The first name is the left (or top) end. Put items in a cell by its column and row names, `column / row: item, item`; a `"label"` before the colon names the cell.

```alignment title="Which kind of hero?"
x: lawful .. neutral .. chaotic
y: good .. neutral .. evil
lawful / good "Crusader": Paladin (keeps every oath), Cleric
neutral / good: Druid (looks after the land)
chaotic / good "Rebel": Bard (helps, breaks the rules)
neutral / neutral "Balance": Monk
lawful / evil "Tyrant": Warlock (a contract for everything)
chaotic / evil "Raider": Rogue (takes what it wants)
```
````

## Alignment grid: points

An item can sit at a point instead: `item @ x, y`, with x and y from 0 to 1 (0 is the first end of the axis, 1 the last, 0.5 the middle). Cells and points can be mixed; here the cells only carry labels.

Alignment grid: Which task first? Columns (x, left to right): low effort, high effort. Rows (y, top to bottom): high impact, low impact.

| cell | items |
| --- | --- |
| low effort / high impact "Do first" | (empty) |
| high effort / high impact "Plan it" | (empty) |
| low effort / low impact "Fill a gap" | (empty) |
| high effort / low impact "Skip" | (empty) |

Points: x and y run from 0 (the first end: low effort, high impact) to 1 (the last end: high effort, low impact).

| item | x | y |
| --- | --- | --- |
| Fix the typo (one line) | 0.12 | 0.22 |
| Add a sample (people copy it) | 0.32 | 0.3 |
| Speed up the build | 0.66 | 0.2 |
| Rewrite the docs site | 0.86 | 0.62 |
| Rename a variable | 0.14 | 0.78 |
| Move the logo | 0.4 | 0.88 |

#### Source: `fixtures/format/36-alignment-grid-points.dh.md`

````text
---
title: "Alignment grid: points"
description: A fixture made from the Format page section of the same name.
---

## Alignment grid: points

An item can sit at a point instead: `item @ x, y`, with x and y from 0 to 1 (0 is the first end of the axis, 1 the last, 0.5 the middle). Cells and points can be mixed; here the cells only carry labels.

```alignment title="Which task first?"
x: low effort .. high effort
y: high impact .. low impact
low effort / high impact "Do first":
high effort / high impact "Plan it":
low effort / low impact "Fill a gap":
high effort / low impact "Skip":
Fix the typo (one line) @ 0.12, 0.22
Add a sample (people copy it) @ 0.32, 0.3
Speed up the build @ 0.66, 0.2
Rewrite the docs site @ 0.86, 0.62
Rename a variable @ 0.14, 0.78
Move the logo @ 0.4, 0.88
```
````

## Alignment grid: any size

Each axis has 2 to 6 names, and the two axes need not match: this grid has five columns and three rows. A grid with more names than that would have cells too small to read.

Alignment grid: How far along is each part? Columns (x, left to right): idea, sketch, draft, review, shipped. Rows (y, top to bottom): small, medium, large.

| cell | items |
| --- | --- |
| idea / small | A clock part |
| shipped / small "Done" | Terminal |
| sketch / medium | A map part |
| draft / medium | Tier list |
| shipped / medium | Editor, File tree |
| review / large | Animation in 3D |

Cells not listed are empty.

#### Source: `fixtures/format/37-alignment-grid-any-size.dh.md`

````text
---
title: "Alignment grid: any size"
description: A fixture made from the Format page section of the same name.
---

## Alignment grid: any size

Each axis has 2 to 6 names, and the two axes need not match: this grid has five columns and three rows. A grid with more names than that would have cells too small to read.

```alignment title="How far along is each part?"
x: idea .. sketch .. draft .. review .. shipped
y: small .. medium .. large
idea / small: A clock part
sketch / medium: A map part
draft / medium: Tier list
review / large: Animation in 3D
shipped / small "Done": Terminal
shipped / medium: Editor, File tree
```
````

## Alignment grid: colours and regions

`[colour]` after a cell's name (and its label) tints that cell. A `region:` line paints a block of cells with a label: write its columns and rows, each one name or `first .. last`. Colours are the theme names `c1` to `c8`, `good`, `warn` and `bad`, never a hex value. `arrows: on` draws an arrow along each axis. A cell's own colour wins over its region's; regions may not overlap.

Alignment grid: Where does each task go? Columns (x, left to right): low effort, medium, high effort. Rows (y, top to bottom): high impact, medium, low impact.

| cell | items |
| --- | --- |
| low effort / high impact "Do first" | Fix the typo |
| medium / high impact | Add a sample |
| high effort / high impact | Move to the new CI (needs a plan) |
| low effort / medium | Speed up the build |
| high effort / low impact | Rewrite the docs site |

Cells not listed are empty.

Region "Quick wins": columns low effort to medium, rows high impact to medium.
Region "Avoid": columns high effort, rows low impact.

#### Source: `fixtures/format/38-alignment-grid-colours-and-regions.dh.md`

````text
---
title: "Alignment grid: colours and regions"
description: A fixture made from the Format page section of the same name.
---

## Alignment grid: colours and regions

`[colour]` after a cell's name (and its label) tints that cell. A `region:` line paints a block of cells with a label: write its columns and rows, each one name or `first .. last`. Colours are the theme names `c1` to `c8`, `good`, `warn` and `bad`, never a hex value. `arrows: on` draws an arrow along each axis. A cell's own colour wins over its region's; regions may not overlap.

```alignment title="Where does each task go?"
x: low effort .. medium .. high effort
y: high impact .. medium .. low impact
arrows: on
region: low effort .. medium / high impact .. medium "Quick wins" [good]
region: high effort / low impact "Avoid" [bad]
low effort / high impact "Do first" [c6]: Fix the typo
medium / high impact: Add a sample
low effort / medium: Speed up the build
high effort / high impact: Move to the new CI (needs a plan)
high effort / low impact: Rewrite the docs site
```
````

## File tree

```filetree
hello-app/
  .scaffold_state.yaml  (new)  # answers, kept for update
  README.md  (generated)
  node_modules/  (closed)
    ...
```

#### Source: `fixtures/format/39-file-tree.dh.md`

````text
---
title: "File tree"
description: A fixture made from the Format page section of the same name.
---

## File tree

```filetree
hello-app/
  .scaffold_state.yaml  (new)  # answers, kept for update
  README.md  (generated)
  node_modules/  (closed)
    ...
```
````

## File tree with steps

```filetree
@step After scaffold create
hello-app/
  .scaffold_state.yaml  (new)  # answers, kept for update
  README.md  (generated)
@step After the user edits it
hello-app/
  .scaffold_state.yaml
  README.md  (changed)  # the user's own edit
  LICENSE  (new)
  old-notes.txt  (removed)
```

#### Source: `fixtures/format/40-file-tree-with-steps.dh.md`

````text
---
title: "File tree with steps"
description: A fixture made from the Format page section of the same name.
---

## File tree with steps

```filetree
@step After scaffold create
hello-app/
  .scaffold_state.yaml  (new)  # answers, kept for update
  README.md  (generated)
@step After the user edits it
hello-app/
  .scaffold_state.yaml
  README.md  (changed)  # the user's own edit
  LICENSE  (new)
  old-notes.txt  (removed)
```
````

## Marks and prefixes

Every mark is written as a word in the source. Each part has a built-in list, and a page or a site may add its own (see the last block of this section); doccheck refuses a word that is in neither. The page shows the word as a chip, so there are no letters to learn.

**File tree:** the mark goes in brackets after the name.

| Written | The page shows | Meaning |
| --- | --- | --- |
| `(new)` | a green "new" chip | the file did not exist before |
| `(changed)` | an orange "changed" chip | the file existed and was edited |
| `(removed)` | a pink "removed" chip, name struck | the file is deleted |
| `(generated)` | a blue "generated" chip | a tool made it; do not edit by hand |
| `(conflict)` | a pink "conflict" chip | two changes disagree here |
| `(closed)` | the folder starts closed | only on a folder |
| `# text` | a note after the name | |
| `...` | a "more files" row | entries left out |

**Editor:** a step's lines are a diff of the file shown.

| Written | Meaning |
| --- | --- |
| `+line` | the line is added (green) |
| `-line` | the line is removed (pink, under "Before") |
| ` line` (a space) | the line is kept, to say where the edit is |
| `@@ <path>` | the edit is in this file |
| `@file <path>` | a made-up file; its lines follow |
| `(open)` | the file shown first |
| an "edited" chip in the tree | the page adds it to a file a step has changed |

**Terminal:** only the start of a line counts.

| Written | Meaning |
| --- | --- |
| `$ ` or `% ` | a command, typed at that prompt |
| `# ` | a command typed as root |
| anything else | output, shown as it is |

**Your own marks and prefixes.** A page may define its own, and a site too (see section 3.1 of the spec): a name, a label and a colour. They show only where a part uses them. The front matter of this page defines two marks and one prompt:

```filetree
app/
  api.ts
  parse.ts  (deprecated)
  next.ts  (experimental)  (new)
```

```terminal
$ python3
>>> print(1 + 1)
2
```

Prompts: >>> is Python (a line typed at the Python prompt).

**Code walk:** `focus=17-18` marks the lines the note is about; `mark=29` puts a marker on one line.

#### Source: `fixtures/format/41-marks-and-prefixes.dh.md`

````text
---
title: "Marks and prefixes"
description: A fixture made from the Format page section of the same name.
marks:
  deprecated:
    label: deprecated
    colour: warn
    means: still works, but will be removed
  experimental:
    label: experimental
    colour: c3
    means: may change without notice
prefixes:
  ">>>":
    label: Python
    colour: c4
    means: a line typed at the Python prompt
---

## Marks and prefixes

Every mark is written as a word in the source. Each part has a built-in list, and a page or a site may add its own (see the last block of this section); doccheck refuses a word that is in neither. The page shows the word as a chip, so there are no letters to learn.

**File tree:** the mark goes in brackets after the name.

| Written | The page shows | Meaning |
| --- | --- | --- |
| `(new)` | a green "new" chip | the file did not exist before |
| `(changed)` | an orange "changed" chip | the file existed and was edited |
| `(removed)` | a pink "removed" chip, name struck | the file is deleted |
| `(generated)` | a blue "generated" chip | a tool made it; do not edit by hand |
| `(conflict)` | a pink "conflict" chip | two changes disagree here |
| `(closed)` | the folder starts closed | only on a folder |
| `# text` | a note after the name | |
| `...` | a "more files" row | entries left out |

**Editor:** a step's lines are a diff of the file shown.

| Written | Meaning |
| --- | --- |
| `+line` | the line is added (green) |
| `-line` | the line is removed (pink, under "Before") |
| ` line` (a space) | the line is kept, to say where the edit is |
| `@@ <path>` | the edit is in this file |
| `@file <path>` | a made-up file; its lines follow |
| `(open)` | the file shown first |
| an "edited" chip in the tree | the page adds it to a file a step has changed |

**Terminal:** only the start of a line counts.

| Written | Meaning |
| --- | --- |
| `$ ` or `% ` | a command, typed at that prompt |
| `# ` | a command typed as root |
| anything else | output, shown as it is |

**Your own marks and prefixes.** A page may define its own, and a site too (see section 3.1 of the spec): a name, a label and a colour. They show only where a part uses them. The front matter of this page defines two marks and one prompt:

```filetree
app/
  api.ts
  parse.ts  (deprecated)
  next.ts  (experimental)  (new)
```

```terminal
$ python3
>>> print(1 + 1)
2
```

**Code walk:** `focus=17-18` marks the lines the note is about; `mark=29` puts a marker on one line.
````

## Editor

A small IDE: the file tree on the left and one file pane. Files come from a repo at the page's pin, or are made up right here with `@file`. Each `@step` is an edit: `+` adds a line, `-` removes one, a space keeps one; `@@ <file>` picks the file.

```editor
@file src/index.ts (open)
import { greet } from './greet';

console.log(greet('hello-app'));
@file src/greet.ts
export function greet(name: string) {
  return 'Hi ' + name;
}
@step Greet with an exclamation mark
@@ src/greet.ts
 export function greet(name: string) {
-  return 'Hi ' + name;
+  return 'Hi ' + name + '!';
 }
@step Pass the license too
@@ src/index.ts
-console.log(greet('hello-app'));
+console.log(greet('hello-app'), 'MIT');
```

#### Source: `fixtures/format/42-editor.dh.md`

````text
---
title: "Editor"
description: A fixture made from the Format page section of the same name.
---

## Editor

A small IDE: the file tree on the left and one file pane. Files come from a repo at the page's pin, or are made up right here with `@file`. Each `@step` is an edit: `+` adds a line, `-` removes one, a space keeps one; `@@ <file>` picks the file.

```editor
@file src/index.ts (open)
import { greet } from './greet';

console.log(greet('hello-app'));
@file src/greet.ts
export function greet(name: string) {
  return 'Hi ' + name;
}
@step Greet with an exclamation mark
@@ src/greet.ts
 export function greet(name: string) {
-  return 'Hi ' + name;
+  return 'Hi ' + name + '!';
 }
@step Pass the license too
@@ src/index.ts
-console.log(greet('hello-app'));
+console.log(greet('hello-app'), 'MIT');
```
````

## Terminal

The shell-session convention every docs site already uses (it is GitHub's and Shiki's `console`/`shellsession`): a line that starts with `$ ` (or `% `, or `# ` for root) is a command, typed at that prompt and highlighted as bash; every other line is output, shown as it is, including a program's own questions and the answers typed into them. Each command is one step. The fence names `console` and `shellsession` give the same part.

```terminal
$ scaffold create acme/hello ./hello-app
? Project name? hello-app
? License? MIT
✔ Created hello-app
$ ls hello-app | grep -v node_modules
README.md
.scaffold_state.yaml
# chown -R app:app hello-app
```

#### Source: `fixtures/format/43-terminal.dh.md`

````text
---
title: "Terminal"
description: A fixture made from the Format page section of the same name.
---

## Terminal

The shell-session convention every docs site already uses (it is GitHub's and Shiki's `console`/`shellsession`): a line that starts with `$ ` (or `% `, or `# ` for root) is a command, typed at that prompt and highlighted as bash; every other line is output, shown as it is, including a program's own questions and the answers typed into them. Each command is one step. The fence names `console` and `shellsession` give the same part.

```terminal
$ scaffold create acme/hello ./hello-app
? Project name? hello-app
? License? MIT
✔ Created hello-app
$ ls hello-app | grep -v node_modules
README.md
.scaffold_state.yaml
# chown -R app:app hello-app
```
````

## Code walk with inline code

A code walk takes code written right here too, with the editor's syntax: before the first `@step`, `@file <path>` makes a file up and its lines follow. A step then names that path; its range may be left out (the whole file). The editor reads repo files the same way the code walk does, so both parts take either.

```codewalk
@file src/greet.ts
export function greet(name: string) {
  const clean = name.trim();
  return 'Hi ' + clean + '!';
}
@step src/greet.ts focus=2
Trim the name first.
@step src/greet.ts#L3 focus=3
Then build the greeting.
```

#### Source: `fixtures/format/44-code-walk-with-inline-code.dh.md`

````text
---
title: "Code walk with inline code"
description: A fixture made from the Format page section of the same name.
---

## Code walk with inline code

A code walk takes code written right here too, with the editor's syntax: before the first `@step`, `@file <path>` makes a file up and its lines follow. A step then names that path; its range may be left out (the whole file). The editor reads repo files the same way the code walk does, so both parts take either.

```codewalk
@file src/greet.ts
export function greet(name: string) {
  const clean = name.trim();
  return 'Hi ' + clean + '!';
}
@step src/greet.ts focus=2
Trim the name first.
@step src/greet.ts#L3 focus=3
Then build the greeting.
```
````

## Code walk: animated or still

A code walk has two modes. **Still** is for moving between different functions or files: the step's file is shown whole, the step's lines are open and marked, and the rest of the file is folded into a bar like "… 12 lines" that the reader can open. A move to the next step switches the marks and the folds at once, with no morph, because a morph between two different functions only confuses. **Animated** is for the same code changing, such as one function growing step by step: the lines morph into each other.

Nothing needs to be written: a move is animated when the next step is in the same file and its lines touch the lines of the step before; every other move is still. To say it, put `animate=on` or `animate=off` on the fence (every move) or on a `@step` line (the move into that step); `animate=auto` is the default.

Still: three steps across two files and three functions.

```codewalk
@file src/cart.ts
export function addItem(cart: Cart, item: Item): Cart {
  const found = cart.items.find((i) => i.sku === item.sku);
  if (found) {
    found.qty += item.qty;
    return cart;
  }
  return { ...cart, items: [...cart.items, item] };
}

export function removeItem(cart: Cart, sku: string): Cart {
  return { ...cart, items: cart.items.filter((i) => i.sku !== sku) };
}

export function total(cart: Cart): number {
  let sum = 0;
  for (const i of cart.items) sum += price(i) * i.qty;
  return sum;
}
@file src/price.ts
const RATES: Record<string, number> = { food: 0.05, book: 0, other: 0.2 };

export function price(item: Item): number {
  const tax = RATES[item.kind] ?? RATES.other;
  return Math.round(item.cents * (1 + tax));
}
@step src/cart.ts#L1-L8 focus=3-6
Adding an item that is already in the cart only raises its quantity.
@step src/cart.ts#L14-L18 focus=16
The total adds up one price for each item, times its quantity.
@step src/price.ts#L1-L6 focus=4-5
The price of one item is its cents plus the tax for its kind.
```

Animated: one function growing, one line at a time.

```codewalk
@file src/slug.ts
export function slugify(title: string): string {
  const lower = title.toLowerCase();
  const words = lower.split(/[^a-z0-9]+/);
  const clean = words.filter(Boolean);
  return clean.join('-');
}
@step src/slug.ts#L1-L2 focus=2
Start with the lower-case title.
@step #L1-L3 focus=3
Split it at anything that is not a letter or a digit.
@step #L1-L4 focus=4
Splitting can leave empty words at the edges; drop them.
@step #L1-L5 focus=5
Join the words with dashes.
```

#### Source: `fixtures/format/45-code-walk-animated-or-still.dh.md`

````text
---
title: "Code walk: animated or still"
description: A fixture made from the Format page section of the same name.
---

## Code walk: animated or still

A code walk has two modes. **Still** is for moving between different functions or files: the step's file is shown whole, the step's lines are open and marked, and the rest of the file is folded into a bar like "… 12 lines" that the reader can open. A move to the next step switches the marks and the folds at once, with no morph, because a morph between two different functions only confuses. **Animated** is for the same code changing, such as one function growing step by step: the lines morph into each other.

Nothing needs to be written: a move is animated when the next step is in the same file and its lines touch the lines of the step before; every other move is still. To say it, put `animate=on` or `animate=off` on the fence (every move) or on a `@step` line (the move into that step); `animate=auto` is the default.

Still: three steps across two files and three functions.

```codewalk
@file src/cart.ts
export function addItem(cart: Cart, item: Item): Cart {
  const found = cart.items.find((i) => i.sku === item.sku);
  if (found) {
    found.qty += item.qty;
    return cart;
  }
  return { ...cart, items: [...cart.items, item] };
}

export function removeItem(cart: Cart, sku: string): Cart {
  return { ...cart, items: cart.items.filter((i) => i.sku !== sku) };
}

export function total(cart: Cart): number {
  let sum = 0;
  for (const i of cart.items) sum += price(i) * i.qty;
  return sum;
}
@file src/price.ts
const RATES: Record<string, number> = { food: 0.05, book: 0, other: 0.2 };

export function price(item: Item): number {
  const tax = RATES[item.kind] ?? RATES.other;
  return Math.round(item.cents * (1 + tax));
}
@step src/cart.ts#L1-L8 focus=3-6
Adding an item that is already in the cart only raises its quantity.
@step src/cart.ts#L14-L18 focus=16
The total adds up one price for each item, times its quantity.
@step src/price.ts#L1-L6 focus=4-5
The price of one item is its cents plus the tax for its kind.
```

Animated: one function growing, one line at a time.

```codewalk
@file src/slug.ts
export function slugify(title: string): string {
  const lower = title.toLowerCase();
  const words = lower.split(/[^a-z0-9]+/);
  const clean = words.filter(Boolean);
  return clean.join('-');
}
@step src/slug.ts#L1-L2 focus=2
Start with the lower-case title.
@step #L1-L3 focus=3
Split it at anything that is not a letter or a digit.
@step #L1-L4 focus=4
Splitting can leave empty words at the edges; drop them.
@step #L1-L5 focus=5
Join the words with dashes.
```
````

## Replacing a part for LLMs

Any part can be followed by `:::llm`; an LLM reads that text instead of the part.

`scaffold create` makes the project folder with the state file `.scaffold_state.yaml` and the files the template made.

#### Source: `fixtures/format/46-replacing-a-part-for-llms.dh.md`

````text
---
title: "Replacing a part for LLMs"
description: A fixture made from the Format page section of the same name.
---

## Replacing a part for LLMs

Any part can be followed by `:::llm`; an LLM reads that text instead of the part.

```filetree
hello-app/
  .scaffold_state.yaml  (new)
  README.md  (generated)
  LICENSE  (generated)
  package.json  (generated)
  src/
    index.ts  (generated)
```

:::llm
`scaffold create` makes the project folder with the state file `.scaffold_state.yaml` and the files the template made.
:::
````

## Chart steps

Each step shows its own data on top of the one before; one control row steps through them.

Chart (line): Requests per second

Step 1: A normal morning.

| time | api |
| --- | --- |
| 10:00 | 120 |
| 10:05 | 130 |
| 10:10 | 125 |

Step 2: The deploy doubles the load.

| time | api |
| --- | --- |
| 10:00 | 120 |
| 10:05 | 130 |
| 10:10 | 260 |

Step 3: A worker joins.

| time | worker |
| --- | --- |
| 10:00 | 1 |
| 10:05 | 2 |
| 10:10 | 3 |

#### Source: `fixtures/format/74-chart-steps.dh.md`

````text
---
title: "Chart steps"
description: A sample of the chart features of format version 11.
---

## Chart steps

Each step shows its own data on top of the one before; one control row steps through them.

```chart
kind: line
title: Requests per second
x: { label: time, values: ["10:00", "10:05", "10:10"] }
series:
  - name: api
    data: [120, 130, 125]
steps:
  - title: A normal morning.
  - title: The deploy doubles the load.
    series:
      - name: api
        data: [120, 130, 260]
  - title: A worker joins.
    series:
      - name: worker
        add: true
        data: [1, 2, 3]
```
````

## Chart time axis and annotations

A time axis in a named zone, with an event, a range and a threshold. Each marker is a button that opens a note.

Chart (line): Latency

Time axis, shown in America/Los_Angeles.

| time | p95 (ms) |
| --- | --- |
| 2026-11-20T10:00 | 120 |
| 2026-11-20T10:05 | 130 |
| 2026-11-20T10:10 | 410 |
| 2026-11-20T10:15 | 150 |

Annotations:
- 2026-11-20 10:08 Deploy v1.4 (event): Moved sessions to the new cache.
- 2026-11-20 10:09 to 10:13 Incident 42 (range)
- y = 300 SLO (threshold; above it is marked)

#### Source: `fixtures/format/75-chart-time-annotations.dh.md`

````text
---
title: "Chart time axis and annotations"
description: A sample of the chart features of format version 11.
---

## Chart time axis and annotations

A time axis in a named zone, with an event, a range and a threshold. Each marker is a button that opens a note.

```chart
kind: line
title: Latency
x: { scale: time }
y: { label: latency, format: duration-ms }
tz: America/Los_Angeles
series:
  - name: p95
    data: [["2026-11-20T10:00", 120], ["2026-11-20T10:05", 130], ["2026-11-20T10:10", 410], ["2026-11-20T10:15", 150]]
annotations:
  - at: 2026-11-20T10:08
    label: Deploy v1.4
    text: Moved sessions to the new cache.
    tone: acc
  - from: 2026-11-20T10:09
    to: 2026-11-20T10:13
    label: Incident 42
    tone: bad
  - y: 300
    label: SLO
    tone: warn
    fill: above
```
````

## Chart heatmap

A heatmap draws one cell per value; an empty cell is null.

Chart (heatmap): Errors by hour

Each cell is the value for one day and one hour (errors).

| day \ hour | 00 | 04 | 08 |
| --- | --- | --- | --- |
| Mon | 0 | 1 | 4 |
| Tue |  | 2 | 12 |

#### Source: `fixtures/format/76-chart-heatmap.dh.md`

````text
---
title: "Chart heatmap"
description: A sample of the chart features of format version 11.
---

## Chart heatmap

A heatmap draws one cell per value; an empty cell is null.

```chart
kind: heatmap
title: Errors by hour
x: { label: hour, values: ["00", "04", "08"] }
y: { label: day, values: [Mon, Tue] }
series:
  - name: errors
    data:
      - [0, 1, 4]
      - [null, 2, 12]
```
````

## Chart line styles and markers

Each series has its own line style and marker, and a key that shows both.

Chart (line)

| month | This year | Forecast | Last year |
| --- | --- | --- | --- |
| Jan | 820 |  | 760 |
| Feb | 860 |  | 790 |
| Mar | 910 | 910 | 840 |
| Apr | 990 | 1000 | 900 |

#### Source: `fixtures/format/77-chart-line-styles.dh.md`

````text
---
title: "Chart line styles and markers"
description: A sample of the chart features of format version 11.
---

## Chart line styles and markers

Each series has its own line style and marker, and a key that shows both.

```chart
kind: line
x: { label: month, values: [Jan, Feb, Mar, Apr] }
y: { label: loans }
series:
  - name: This year
    line: solid
    marker: circle
    data: [820, 860, 910, 990]
  - name: Forecast
    line: dashed
    marker: diamond
    data: [null, null, 910, 1000]
  - name: Last year
    line: dotted
    marker: none
    data: [760, 790, 840, 900]
```
````

## Chart log and linear switch

The reader can switch the y axis between log and linear.

Chart (line)

The reader can switch the y axis between log and linear; it starts as log.

Log scale on y.

| year | Web | Batch |
| --- | --- | --- |
| 2020 | 1200 | 30 |
| 2021 | 8100 | 70 |
| 2022 | 61000 | 150 |
| 2023 | 410000 | 400 |

#### Source: `fixtures/format/78-chart-log-toggle.dh.md`

````text
---
title: "Chart log and linear switch"
description: A sample of the chart features of format version 11.
---

## Chart log and linear switch

The reader can switch the y axis between log and linear.

```chart
kind: line
x: { label: year, values: [2020, 2021, 2022, 2023] }
y: { label: requests, scale: log, toggle: true }
series:
  - name: Web
    data: [1200, 8100, 61000, 410000]
  - name: Batch
    data: [30, 70, 150, 400]
```
````

## Chart calculator

The calculator layout: inputs, one row per formula and one result.

Calculator: Storage bill

Inputs:
| Input | Starts at | Can be |
| --- | --- | --- |
| Data stored | 1200 GB | 100 to 5000 GB |
| Price per GB | 0.023 USD per GB | 0.01 to 0.1 USD per GB |
| Second copy | off | on or off |

Formulas, at the start values:
- Storage = Data stored × Price per GB × (Second copy ? 2 : 1) = $27.60
- Fees = Data stored ÷ 100 = 12 units

Result: Monthly bill = Storage + Fees = $39.60

#### Source: `fixtures/format/79-chart-calculator.dh.md`

````text
---
title: "Chart calculator"
description: A sample of the chart features of format version 11.
---

## Chart calculator

The calculator layout: inputs, one row per formula and one result.

```chart
layout: calculator
title: Storage bill
controls:
  - slider: stored
    label: Data stored
    unit: GB
    min: 100
    max: 5000
    step: 100
    value: 1200
  - slider: price
    label: Price per GB
    unit: USD per GB
    min: 0.01
    max: 0.1
    step: 0.001
    value: 0.023
  - toggle: second
    label: Second copy
    value: false
let:
  storage: "stored * price * (second ? 2 : 1)"
  fees: stored / 100
  total: storage + fees
calc:
  - let: storage
    label: Storage
    format: money
  - let: fees
    label: Fees
    unit: units
  - let: total
    label: Monthly bill
    format: money
    result: true
```
````

## References

A part on a line of its own is a block: the host's resolver answers for it, and without one the label shows as a chip.

[[chart:revenue-2026 "Revenue by month, 2026"]]

[[svg:architecture.dark "The system at a glance"]]

[[interactive:compound-growth "Compound growth, with a slider"]]

Inside a sentence a reference is a chip: the build log is in [[terminal:build-42 "the build"]], and the label is optional, as in [[filetree:repo-layout]].

In code it is text: `[[chart:revenue-2026]]` stays as written, and so does a fence:

```text
[[svg:logo "not a reference here"]]
```

A word that is not a part type is plain text too: [[note:this]] and [[1, 2]].

#### Source: `fixtures/format/80-references.dh.md`

````text
---
title: "References"
description: Parts the host keeps, referenced by type and name; the page holds only the reference and its label.
---

## References

A part on a line of its own is a block: the host's resolver answers for it, and without one the label shows as a chip.

[[chart:revenue-2026 "Revenue by month, 2026"]]

[[svg:architecture.dark "The system at a glance"]]

[[interactive:compound-growth "Compound growth, with a slider"]]

Inside a sentence a reference is a chip: the build log is in [[terminal:build-42 "the build"]], and the label is optional, as in [[filetree:repo-layout]].

In code it is text: `[[chart:revenue-2026]]` stays as written, and so does a fence:

```text
[[svg:logo "not a reference here"]]
```

A word that is not a part type is plain text too: [[note:this]] and [[1, 2]].
````

## Static: the same parts live and still

Any part that steps or moves can stand still. `static` on the fence draws the finished state, and `static=2` or `static="<step title>"` draws that step, with no player, no control row and no motion. Printing, a page with `static: true` in its front matter, a host option and the reader's "reduce motion" setting use the same option. The LLM view is the same for both.

### A scene

Live:

Animation, 3 steps. Starts with: person u "reader"; box web "web server"; cylinder db "database"; box log "access log".

1. The reader asks for a page.
2. The server reads the row it needs.
3. The server writes the visit to its log.

Static, the finished state:

Animation, 3 steps. Starts with: person u "reader"; box web "web server"; cylinder db "database"; box log "access log".

1. The reader asks for a page.
2. The server reads the row it needs.
3. The server writes the visit to its log.

### A terminal

Live:

```terminal
$ bun add durian-hypermedia
installed durian-hypermedia
$ bun test
301 pass, 0 fail
```

Static, every command typed:

```terminal static=
$ bun add durian-hypermedia
installed durian-hypermedia
$ bun test
301 pass, 0 fail
```

### A file tree

Live:

```filetree
@step The app starts with one file
app/
  api.ts
@step A parser joins it
app/
  api.ts
  parse.ts  (new)
```

Static, the step named "The app starts with one file":

```filetree static=1
@step The app starts with one file
app/
  api.ts
@step A parser joins it
app/
  api.ts
  parse.ts  (new)
```

#### Source: `fixtures/format/81-static-live-and-still.dh.md`

````text
---
title: "Static: the same parts live and still"
description: The same scene, terminal and file tree twice, live and then static (SPEC 4.1); print draws every part this way.
---

## Static: the same parts live and still

Any part that steps or moves can stand still. `static` on the fence draws the finished state, and `static=2` or `static="<step title>"` draws that step, with no player, no control row and no motion. Printing, a page with `static: true` in its front matter, a host option and the reader's "reduce motion" setting use the same option. The LLM view is the same for both.

### A scene

Live:

```animation layout=graph
person u "reader"
box web "web server"
cylinder db "database"
box log "access log"
@step The reader asks for a page.
u -> web "GET /"
@step The server reads the row it needs.
web -> db "SELECT"
@step The server writes the visit to its log.
web -> log "visit"
```

Static, the finished state:

```animation layout=graph static
person u "reader"
box web "web server"
cylinder db "database"
box log "access log"
@step The reader asks for a page.
u -> web "GET /"
@step The server reads the row it needs.
web -> db "SELECT"
@step The server writes the visit to its log.
web -> log "visit"
```

### A terminal

Live:

```terminal title="setup"
$ bun add durian-hypermedia
installed durian-hypermedia
$ bun test
301 pass, 0 fail
```

Static, every command typed:

```terminal title="setup" static
$ bun add durian-hypermedia
installed durian-hypermedia
$ bun test
301 pass, 0 fail
```

### A file tree

Live:

```filetree
@step The app starts with one file
app/
  api.ts
@step A parser joins it
app/
  api.ts
  parse.ts  (new)
```

Static, the step named "The app starts with one file":

```filetree static="The app starts with one file"
@step The app starts with one file
app/
  api.ts
@step A parser joins it
app/
  api.ts
  parse.ts  (new)
```
````

## State: a state machine that its steps walk

A `state` part draws a state machine from its transitions. `at` says where the walk is, and `fire` takes the one transition with that event from there.

State machine: An order. Starts at cart; ends after shipped.

| from | on | to |
| --- | --- | --- |
| cart | check out | paying |
| paying | card accepted | paid |
| paying | card declined | cart |
| paid | ship | shipped |

- paying (Paying): waits up to 10 minutes for the bank
- done (Fulfilment), a group of paid, shipped; a transition to it enters paid

1. A shopper fills the cart.
   at cart
2. They check out.
   cart -> paying (check out)
3. The bank declines the card: back to the cart.
   paying -> cart (card declined)
4. They try another card, and the bank takes it.
   at paying
   paying -> paid (card accepted)

The same machine, static (the finished walk, no player):

State machine: An order, static. Starts at cart; ends after shipped.

| from | on | to |
| --- | --- | --- |
| cart | check out | paying |
| paying | card accepted | paid |
| paying | card declined | cart |
| paid | ship | shipped |

- paying (Paying): waits up to 10 minutes for the bank
- done (Fulfilment), a group of paid, shipped; a transition to it enters paid

1. A shopper fills the cart.
   at cart
2. They check out.
   cart -> paying (check out)
3. The bank declines the card: back to the cart.
   paying -> cart (card declined)
4. They try another card, and the bank takes it.
   at paying
   paying -> paid (card accepted)

#### Source: `fixtures/format/90-state-diagram.dh.md`

````text
---
title: "State: a state machine that its steps walk"
description: A state diagram drawn from its transitions; each step walks one transition (SPEC 3.2 State). Shown live, then static.
---

## State: a state machine that its steps walk

A `state` part draws a state machine from its transitions. `at` says where the walk is, and `fire` takes the one transition with that event from there.

```state title="An order"
[start] -> cart
cart -> paying "check out"
paying -> paid "card accepted"
paying -> cart "card declined"
paid -> shipped "ship"
shipped -> [end]
state paying "Paying" note="waits up to 10 minutes for the bank"
group done "Fulfilment": paid, shipped
@step A shopper fills the cart.
at cart
@step They check out.
fire check out
@step The bank declines the card: back to the cart.
fire card declined
@step They try another card, and the bank takes it.
at paying
fire card accepted
```

The same machine, static (the finished walk, no player):

```state static=true title="An order, static"
[start] -> cart
cart -> paying "check out"
paying -> paid "card accepted"
paying -> cart "card declined"
paid -> shipped "ship"
shipped -> [end]
state paying "Paying" note="waits up to 10 minutes for the bank"
group done "Fulfilment": paid, shipped
@step A shopper fills the cart.
at cart
@step They check out.
fire check out
@step The bank declines the card: back to the cart.
fire card declined
@step They try another card, and the bank takes it.
at paying
fire card accepted
```
````

## Class: types and how they relate

A `class` part draws classes from their members and from relations written in words: `extends`, `implements`, `owns`, `has`, `uses` and `->`.

Class diagram: Orders.

class Order implements Payable: + id: OrderId; + total(): Money; - lines: Line[] (An order is written once, at check out.)
class Line: + quantity: int
interface Payable: + pay(amount: Money): Receipt
abstract class Shape
enum Status: open, paid, shipped

Order owns 1 or more Line (composition). Order has 1 Status (aggregation). Circle extends Shape. Order uses Clock (dependency). Order placed by 1 Customer (association; each Customer has 0 or more Order).

The same diagram, static:

Class diagram: Orders, static.

class Order implements Payable: + id: OrderId; + total(): Money; - lines: Line[] (An order is written once, at check out.)
class Line: + quantity: int
interface Payable: + pay(amount: Money): Receipt
abstract class Shape
enum Status: open, paid, shipped

Order owns 1 or more Line (composition). Order has 1 Status (aggregation). Circle extends Shape. Order uses Clock (dependency). Order placed by 1 Customer (association; each Customer has 0 or more Order).

#### Source: `fixtures/format/91-class-diagram.dh.md`

````text
---
title: "Class: types and how they relate"
description: A class diagram drawn from members and relations written in words (SPEC 3.2 Class). Shown whole, then static.
---

## Class: types and how they relate

A `class` part draws classes from their members and from relations written in words: `extends`, `implements`, `owns`, `has`, `uses` and `->`.

```class title="Orders"
class Order note="An order is written once, at check out."
  + id: OrderId
  + total(): Money
  - lines: Line[]
class Line
  + quantity: int
interface Payable
  + pay(amount: Money): Receipt
abstract class Shape
enum Status: open, paid, shipped
Order implements Payable
Order owns 1..* Line
Order has 1 Status
Circle extends Shape
Order uses Clock
Order 0..* -> 1 Customer "placed by"
```

The same diagram, static:

```class static=true title="Orders, static"
class Order note="An order is written once, at check out."
  + id: OrderId
  + total(): Money
  - lines: Line[]
class Line
  + quantity: int
interface Payable
  + pay(amount: Money): Receipt
abstract class Shape
enum Status: open, paid, shipped
Order implements Payable
Order owns 1..* Line
Order has 1 Status
Circle extends Shape
Order uses Clock
Order 0..* -> 1 Customer "placed by"
```
````

## ER: tables and their keys

An `er` part draws tables with their keys and joins them with crow's-foot lines, each from the key to what it points at. A step may light a table or a column.

ER diagram: Shop.

customer (Customer): id uuid pk; email text unique
order (Order): id uuid pk; customer_id uuid fk -> customer.id; placed_at timestamptz
line (Order line): order_id uuid fk -> order.id; product text; quantity int

A customer places 0 or more orders; an order belongs to exactly 1 customer. An order holds 1 or more lines; a line belongs to exactly 1 order.

1. Start from the customer's key.
   lit: customer.id
2. Each order keeps it in `customer_id`.
   lit: order.customer_id
3. Each line of an order keeps the order's key in `order_id`.
   lit: line.order_id

The same diagram, static:

ER diagram: Shop, static.

customer (Customer): id uuid pk; email text unique
order (Order): id uuid pk; customer_id uuid fk -> customer.id; placed_at timestamptz
line (Order line): order_id uuid fk -> order.id; product text; quantity int

A customer places 0 or more orders; an order belongs to exactly 1 customer. An order holds 1 or more lines; a line belongs to exactly 1 order.

1. Start from the customer's key.
   lit: customer.id
2. Each order keeps it in `customer_id`.
   lit: order.customer_id
3. Each line of an order keeps the order's key in `order_id`.
   lit: line.order_id

#### Source: `fixtures/format/92-er-diagram.dh.md`

````text
---
title: "ER: tables and their keys"
description: An entity-relationship diagram with crow's-foot lines from key to key (SPEC 3.2 ER). Shown live, then static.
---

## ER: tables and their keys

An `er` part draws tables with their keys and joins them with crow's-foot lines, each from the key to what it points at. A step may light a table or a column.

```er title="Shop"
entity customer "Customer" [c1]
  id uuid pk
  email text unique
entity order "Order" [c2]
  id uuid pk
  customer_id uuid fk -> customer.id
  placed_at timestamptz
entity line "Order line" [c2]
  order_id uuid fk -> order.id
  product text
  quantity int
customer 1 -- 0..* order "places"
order 1 -- 1..* line "holds"
@step Start from the customer's key.
highlight customer.id
@step Each order keeps it in `customer_id`.
highlight order.customer_id
@step Each line of an order keeps the order's key in `order_id`.
highlight line.order_id
```

The same diagram, static:

```er static=true title="Shop, static"
entity customer "Customer" [c1]
  id uuid pk
  email text unique
entity order "Order" [c2]
  id uuid pk
  customer_id uuid fk -> customer.id
  placed_at timestamptz
entity line "Order line" [c2]
  order_id uuid fk -> order.id
  product text
  quantity int
customer 1 -- 0..* order "places"
order 1 -- 1..* line "holds"
@step Start from the customer's key.
highlight customer.id
@step Each order keeps it in `customer_id`.
highlight order.customer_id
@step Each line of an order keeps the order's key in `order_id`.
highlight line.order_id
```
````

# Animations (graph engine)

## Animation: the engine

One language for every animation: a free 2D space of **entities** (shapes, containers, data structures, tokens), **connectors** that follow their ends, **layouts** that place things, a **camera**, and **steps** of changes that run together. The reader can step, or explore: drag to move, pinch or Ctrl + wheel to zoom, click a thing to read its note, then "Back to the story". Here, an array is sorted: `swap` trades two cells, `highlight` lights them for one step, a pointer moves.

Animation, 5 steps. Starts with: array a: 5, 2, 8, 1; pointer i at a.0.

1. Bubble sort compares neighbours. 5 and 2 are out of order.
2. So they swap: 2 now comes first.
3. It compares 5 and 8: in order, so they stay.
4. 8 and 1 are not: they swap, and 8, the biggest, has reached the end.
5. Two more passes move 1 to the front. The array is sorted.

#### Source: `fixtures/format/47-animation-the-engine.dh.md`

````text
---
title: "Animation: the engine"
description: A fixture made from the Format page section of the same name.
---

## Animation: the engine

One language for every animation: a free 2D space of **entities** (shapes, containers, data structures, tokens), **connectors** that follow their ends, **layouts** that place things, a **camera**, and **steps** of changes that run together. The reader can step, or explore: drag to move, pinch or Ctrl + wheel to zoom, click a thing to read its note, then "Back to the story". Here, an array is sorted: `swap` trades two cells, `highlight` lights them for one step, a pointer moves.

```animation
array a: 5 2 8 1
pointer i "i" at a.0
@step Bubble sort compares neighbours. 5 and 2 are out of order.
highlight a.0 a.1
@step So they swap: 2 now comes first.
swap a.0 a.1
@step It compares 5 and 8: in order, so they stay.
move i to a.1
highlight a.1 a.2
@step 8 and 1 are not: they swap, and 8, the biggest, has reached the end.
move i to a.2
swap a.2 a.3
set a.3 tone=good
@step Two more passes move 1 to the front. The array is sorted.
swap a.1 a.2
swap a.0 a.1
set a.0 tone=good
set a.1 tone=good
set a.2 tone=good
remove i
```
````

## Animation: binary search tree insert

A `tree` lays out its nodes; `under n3 right` puts a node on a side. A token walks down, and the camera moves in for the insert.

Animation, 4 steps. Starts with: tree t [circle n8 "8", circle n3 "3" under n8 left, circle n10 "10" under n8 right, circle n1 "1" under n3 left, circle n14 "14" under n10 right].

1. Insert 6. Start at the root: 6 is less than 8, so go left.
2. 6 is more than 3, so go right.
   n8 -> n3: 6
3. 3 has no right child: 6 goes there.
4. The order holds: everything left of a node is smaller, everything right of it is bigger.

#### Source: `fixtures/format/48-animation-binary-search-tree-insert.dh.md`

````text
---
title: "Animation: binary search tree insert"
description: A fixture made from the Format page section of the same name.
---

## Animation: binary search tree insert

A `tree` lays out its nodes; `under n3 right` puts a node on a side. A token walks down, and the camera moves in for the insert.

```animation
tree t
circle n8 "8" in t
circle n3 "3" in t under n8 left
circle n10 "10" in t under n8 right
circle n1 "1" in t under n3 left
circle n14 "14" in t under n10 right
@step Insert 6. Start at the root: 6 is less than 8, so go left.
add token k "6" at n8
highlight n8
@step 6 is more than 3, so go right.
move k to n3
highlight n3
@step 3 has no right child: 6 goes there.
add circle n6 "6" in t under n3 right
remove k
set n6 tone=good
camera n3
@step The order holds: everything left of a node is smaller, everything right of it is bigger.
camera all
```
````

## Animation: hash table with a collision

`buckets` makes a hash table's buckets; two keys in one bucket make a chain. `send` moves a token along a path.

Animation, 5 steps. Starts with: buckets h "hash table" (5).

1. hash("apple") mod 5 is 2, so apple goes in bucket 2.
2. hash("kiwi") mod 5 is 4; bucket 4 is empty.
3. hash("grape") mod 5 is also 2: a collision.
4. The bucket keeps a chain. Finding grape starts at bucket 2, which leads to apple.
   h.2 -> apple: find grape
5. apple is not grape, so the search follows the chain one more link, to grape.
   apple -> grape: find grape

#### Source: `fixtures/format/49-animation-hash-table-with-a-collision.dh.md`

````text
---
title: "Animation: hash table with a collision"
description: A fixture made from the Format page section of the same name.
---

## Animation: hash table with a collision

`buckets` makes a hash table's buckets; two keys in one bucket make a chain. `send` moves a token along a path.

```animation
buckets h "hash table" count=5
@step hash("apple") mod 5 is 2, so apple goes in bucket 2.
add pill apple "apple" in h.2
highlight h.2
@step hash("kiwi") mod 5 is 4; bucket 4 is empty.
add pill kiwi "kiwi" in h.4
@step hash("grape") mod 5 is also 2: a collision.
add pill grape "grape" in h.2
highlight apple grape tone=warn
say h.2: two keys, one bucket
@step The bucket keeps a chain. Finding grape starts at bucket 2, which leads to apple.
send "find grape" h.2 -> apple
camera h.2 close
@step apple is not grape, so the search follows the chain one more link, to grape.
send "find grape" apple -> grape
```
````

## Animation: sharding, then rebalancing

Shards are containers holding key ranges; `move` puts a range in another shard, and its connectors follow.

Animation, 4 steps. Starts with: pill router; group s1 "shard 1" [pill k1 "users 1–100", pill k2 "users 101–200"]; group s2 "shard 2" [pill k3 "users 201–300", pill k4 "users 301–400"]. Connected: router -> s1, router -> s2.

1. The router sends each request to the shard that holds the user's key range.
   router -> s2: user 250
2. Shard 2 is getting full. A third shard joins, empty.
3. Rebalance: the range 301–400 moves to shard 3.
4. The router's map changes with it: user 350 now goes to shard 3.
   router -> s3: user 350

#### Source: `fixtures/format/50-animation-sharding-then-rebalancing.dh.md`

````text
---
title: "Animation: sharding, then rebalancing"
description: A fixture made from the Format page section of the same name.
---

## Animation: sharding, then rebalancing

Shards are containers holding key ranges; `move` puts a range in another shard, and its connectors follow.

```animation
pill router "router"
group s1 "shard 1" layout=column
group s2 "shard 2" layout=column
pill k1 "users 1–100" in s1
pill k2 "users 101–200" in s1
pill k3 "users 201–300" in s2
pill k4 "users 301–400" in s2
router -> s1
router -> s2
note router: maps each key range to a shard
@step The router sends each request to the shard that holds the user's key range.
send "user 250" router -> s2
@step Shard 2 is getting full. A third shard joins, empty.
add group s3 "shard 3" layout=column
router -> s3
set s2 tone=warn
@step Rebalance: the range 301–400 moves to shard 3.
move k4 to s3
set s2 tone=plain
@step The router's map changes with it: user 350 now goes to shard 3.
send "user 350" router -> s3
```
````

## Animation: replicas and failover

`set d1 down=yes` takes the primary down; `move d2 to pg` promotes a replica into the primary's place, and the connectors change with it.

Animation, 6 steps. Starts with: pill app; group pg "primary" [cylinder d1 "db-1"]; group rg "replicas" [cylinder d2 "db-2", cylinder d3 "db-3"]. Connected: app -> d1 "writes", d1 --> d2 "copies", d1 --> d3 "copies". Families, one colour each: app "the app" (app, app -> d1); db "databases" (d1, d2, d3); copy "copying" (d1 -> d2, d1 -> d3).

1. The app writes to the primary.
   app -> d1: write
2. The primary copies the write to both replicas.
   d1 -> d2: copy
   d1 -> d3: copy
3. The primary's machine dies, so it can take no more writes.
4. db-2 has the newest copy, so it is promoted: it moves to the primary's place, and the app writes to it.
5. The dead one is taken out, and the app writes to the new primary.
   app -> d2: write
6. db-3 now copies from the new primary.
   d2 -> d3: copy

#### Source: `fixtures/format/51-animation-replicas-and-failover.dh.md`

````text
---
title: "Animation: replicas and failover"
description: A fixture made from the Format page section of the same name.
---

## Animation: replicas and failover

`set d1 down=yes` takes the primary down; `move d2 to pg` promotes a replica into the primary's place, and the connectors change with it.

```animation
family app "the app"
family db "databases"
family copy "copying"
pill app "app" is=app
group pg "primary" layout=column
cylinder d1 "db-1" in pg is=db
group rg "replicas" layout=column
cylinder d2 "db-2" in rg is=db
cylinder d3 "db-3" in rg is=db
app -> d1 "writes" is=app
d1 --> d2 "copies" is=copy
d1 --> d3 "copies" is=copy
@step The app writes to the primary.
send "write" app -> d1
@step The primary copies the write to both replicas.
send "copy" d1 -> d2 is=copy
send "copy" d1 -> d3 is=copy
@step The primary's machine dies, so it can take no more writes.
set d1 down=yes
say d1: no heartbeat
@step db-2 has the newest copy, so it is promoted: it moves to the primary's place, and the app writes to it.
move d2 to pg
remove app -> d1
app -> d2 "writes" is=app
@step The dead one is taken out, and the app writes to the new primary.
remove d1
d2 --> d3 "copies" is=copy
send "write" app -> d2
@step db-3 now copies from the new primary.
send "copy" d2 -> d3 is=copy
```
````

## Animation: pods, nodes, a service

Containers nest: pods in nodes in a cluster. A service is a stable name in front of pods; when a node dies, a pod is started elsewhere.

Animation, 5 steps. Starts with: group cluster [group n1 "node 1" [pill w1 "web-1", pill c1 "cache-1"], group n2 "node 2" [pill w2 "web-2"], group n3 "node 3" [pill w3 "web-3"]]; pill svc "service: web". Connected: svc -> w1, svc -> w2, svc -> w3. Families, one colour each: svc "service" (svc, svc -> w1, svc -> w2, svc -> w3); web "web pods" (w1, w2, w3); cache "cache pods" (c1).

1. Pods run on nodes; nodes make up the cluster. The service is one name in front of the three web pods.
2. Calls to the service are spread over its pods: rules on every node pick one.
   svc -> w1: GET /
   svc -> w2: GET /cart
3. Node 2 dies, and web-2 with it.
4. The scheduler starts a new web-2 on node 3, which has room.
5. The rules now pick among the running pods only; nobody sees a gap.
   svc -> w2b: GET /cart

#### Source: `fixtures/format/52-animation-pods-nodes-a-service.dh.md`

````text
---
title: "Animation: pods, nodes, a service"
description: A fixture made from the Format page section of the same name.
---

## Animation: pods, nodes, a service

Containers nest: pods in nodes in a cluster. A service is a stable name in front of pods; when a node dies, a pod is started elsewhere.

```animation dir=down
family svc "service"
family web "web pods"
family cache "cache pods"
group cluster "cluster" layout=row
group n1 "node 1" in cluster
group n2 "node 2" in cluster
group n3 "node 3" in cluster
pill w1 "web-1" in n1 is=web
pill c1 "cache-1" in n1 is=cache
pill w2 "web-2" in n2 is=web
pill w3 "web-3" in n3 is=web
pill svc "service: web" is=svc
svc -> w1 is=svc
svc -> w2 is=svc
svc -> w3 is=svc
note svc: one stable name and address in front of the web pods
@step Pods run on nodes; nodes make up the cluster. The service is one name in front of the three web pods.
camera all
@step Calls to the service are spread over its pods: rules on every node pick one.
send "GET /" svc -> w1
send "GET /cart" svc -> w2
@step Node 2 dies, and web-2 with it.
set n2 down=yes
set w2 down=yes
camera cluster
@step The scheduler starts a new web-2 on node 3, which has room.
remove w2
add pill w2b "web-2" in n3 is=web
svc -> w2b is=svc
@step The rules now pick among the running pods only; nobody sees a gap.
send "GET /cart" svc -> w2b
camera all
```
````

## Animation: a service mesh

Each pod holds its app and a sidecar proxy, on two nodes with the network under them; the control plane, a pod of its own on node 1, pushes config to the proxies. A `send` shows its movement as a small token (the default), as an arrow that draws itself from source to target (`send arrow`), or both (`send both`); an LLM reads each the same way, as `a -> b: label` under the step. `family app "apps"` names a family in the setup and `is=app` gives a thing, a connector or a send its colour: each family gets one colour from a fixed palette (a soft fill, a line, an ink for words), the same on every shape, arrow, token and chip, in light and dark, with a legend above the stage. A send takes the colour of the thing it starts from.

Animation, 13 steps, flat. Node 1 (the control plane's mesh config; pod orders: the orders app and its proxy; node 1's network card), the network under the cluster, node 2 (pod payments: its proxy and the payments app; node 2's network card).

1. to 6. The orders app calls its own proxy; the proxy encrypts the call with mutual TLS and sends it out of node 1's card, across the network, into node 2's card, to the payments proxy, which decrypts it and hands it to its app.
7. The control plane pushes "retry twice" to the orders proxy. No app changes.
8. A call fails once at the payments app.
9. to 13. The orders proxy retries by itself on the same path; the payments app takes the second try.

#### Source: `fixtures/format/53-animation-a-service-mesh.dh.md`

````text
---
title: "Animation: a service mesh"
description: A fixture made from the Format page section of the same name.
---

## Animation: a service mesh

Each pod holds its app and a sidecar proxy, on two nodes with the network under them; the control plane, a pod of its own on node 1, pushes config to the proxies. A `send` shows its movement as a small token (the default), as an arrow that draws itself from source to target (`send arrow`), or both (`send both`); an LLM reads each the same way, as `a -> b: label` under the step. `family app "apps"` names a family in the setup and `is=app` gives a thing, a connector or a send its colour: each family gets one colour from a fixed palette (a soft fill, a line, an ink for words), the same on every shape, arrow, token and chip, in light and dark, with a legend above the stage. A send takes the colour of the thing it starts from.

```animation layout=row
family app "apps"
family proxy "sidecar proxies"
family net "network cards and the network"
family ctl "control plane"
group n1 "node 1" layout=column note="node IP 198.51.100.21"
group cp "control plane" in n1 is=ctl
box cfg "mesh config" in cp is=ctl note="holds the mesh's rules and pushes them to the proxies; it runs in a pod of its own, here on node 1"
group pa "pod: orders" in n1 layout=row
box a "orders app" in pa is=app
box pxa "proxy" in pa is=proxy note="the orders pod's sidecar; pod IP 198.51.100.4"
box e1 "network card" in n1 is=net note="eth0, node 1's network card"
box net "the network" is=net note="the network under the cluster: it carries the bytes from node to node and only ever sees them encrypted"
group n2 "node 2" layout=column note="node IP 198.51.100.22"
box e2 "network card" in n2 is=net note="eth0, node 2's network card"
group pb "pod: payments" in n2 layout=row
box pxb "proxy" in pb is=proxy note="the payments pod's sidecar; pod IP 198.51.100.7"
box b "payments app" in pb is=app
e1 -> net
net -> e2
@step Each pod runs its app and a sidecar proxy. The app talks only to its own proxy: pay order 7.
send both a -> pxa
@step The orders proxy encrypts the call with mutual TLS and sends it from its pod's IP, out through node 1's network card.
send both "encrypted" pxa -> e1
@step The network under the cluster carries the encrypted bytes toward node 2. It cannot read them.
send "encrypted" e1 -> net
@step It delivers them to node 2's network card.
send net -> e2
@step Node 2 hands them to the payments proxy, which decrypts the call. Each side has proved who it is.
send both "pay order 7" e2 -> pxb
@step The payments proxy hands "pay order 7" to its app. Neither app sees the encryption.
send both pxb -> b
@step The control plane pushes a new rule to the orders proxy: retry twice. No app changes.
send arrow "retry: 2" cfg -> pxa
say pxa: retries twice on failure
@step A call fails once at the payments app.
highlight b tone=hot
say b: failed once
@step The orders proxy retries by itself, out through node 1's card again.
send both "retry" pxa -> e1
@step Across the network, still encrypted.
send "retry" e1 -> net
@step Into node 2's card.
send "retry" net -> e2
@step To the payments proxy, which decrypts it.
send e2 -> pxb
@step This time the payments app takes the call.
send both pxb -> b
```

:::llm
Animation, 13 steps, flat. Node 1 (the control plane's mesh config; pod orders: the orders app and its proxy; node 1's network card), the network under the cluster, node 2 (pod payments: its proxy and the payments app; node 2's network card).

1. to 6. The orders app calls its own proxy; the proxy encrypts the call with mutual TLS and sends it out of node 1's card, across the network, into node 2's card, to the payments proxy, which decrypts it and hands it to its app.
7. The control plane pushes "retry twice" to the orders proxy. No app changes.
8. A call fails once at the payments app.
9. to 13. The orders proxy retries by itself on the same path; the payments app takes the second try.
:::
````

## Animation: not only code

The same entities tell any story: how a bill becomes a law (in the United States, simplified).

Animation, 5 steps. Starts with: person rep "member of the House"; group house "House"; group senate "Senate"; person pres "President"; box law; token bill at rep. Connected: rep -> house, house -> senate, senate -> pres, pres -> law.

1. A member of the House writes a bill and introduces it.
2. A House committee studies it; then the whole House votes, and a majority passes it.
   rep -> house: bill
3. The Senate does the same: its own committee, its own vote.
   house -> senate: bill
4. The President signs it.
   senate -> pres: bill
5. The bill is now a law.
   pres -> law: bill

#### Source: `fixtures/format/54-animation-not-only-code.dh.md`

````text
---
title: "Animation: not only code"
description: A fixture made from the Format page section of the same name.
---

## Animation: not only code

The same entities tell any story: how a bill becomes a law (in the United States, simplified).

```animation dir=down
person rep "member of the House"
group house "House"
group senate "Senate"
person pres "President"
box law "law"
rep -> house
house -> senate
senate -> pres
pres -> law
token bill "bill" at rep
@step A member of the House writes a bill and introduces it.
highlight rep
@step A House committee studies it; then the whole House votes, and a majority passes it.
move bill to house
add pill hc "committee" in house
add pill hv "vote: passed" in house tone=good
@step The Senate does the same: its own committee, its own vote.
move bill to senate
add pill sc "committee" in senate
add pill sv "vote: passed" in senate tone=good
@step The President signs it.
move bill to pres
say pres: signed
@step The bill is now a law.
move bill to law
set law tone=good
```
````

## Animation: colour families, the way a diagram uses them

Colour marks what a thing *is*, and words stay readable: a family's colour goes on the border, the lines and the dots, with a light tint inside (`fill=soft`, the default) or none (`fill=none`, the border only); the words are always in ink. A container can be one family and hold things of other families: each keeps its own colour. A thing of the same family as its container drops the tint, so it stands out. Set `fill=` on one thing, or on the whole scene (`` ```animation fill=none ``). Here, letters go from post boxes (border only) through a sorting centre (one family) whose two machines are two other families.

Animation, 6 steps. Starts with: group boxes "post boxes" [box p1 "Hill Road", box p2 "Lake Street", box p3 "Market Square"]; group c1 "north centre" [box c1a "machine A", box c1b "machine B"]; group c2 "south centre" [box c2a "machine A", box c2b "machine B"]; group vans [box v1 "van 1", box v2 "van 2"]; cylinder po "post office". Connected: p1 --> c1, p2 --> c1, p3 --> c2, c1 --> v1, c2 --> v2, v1 --> po, v2 --> po. Families, one colour each: box "post boxes" (p1, p2, p3, p1 -> c1, p2 -> c1, p3 -> c2); sort "sorting centres" (c1, c2, c1 -> v1, c2 -> v2); a "machine A" (c1a, c2a); b "machine B" (c1b, c2b); van "vans" (vans, v1, v2, po, v1 -> po, v2 -> po).

1. Letters wait in three post boxes. The colours say what each thing is; the words stay in ink.
2. A collection takes the Hill Road letters to the north centre.
   p1 -> c1: letters
3. Machine A reads the addresses. Machine B, another family inside the same centre, stands by.
4. Machine A breaks down, and machine B takes over.
5. The sorted letters go out to van 1.
   c1 -> v1: sorted
6. Van 1 takes them to the post office.
   v1 -> po: delivery

#### Source: `fixtures/format/55-animation-colour-families-the-way-a-diagram-uses-them.dh.md`

````text
---
title: "Animation: colour families, the way a diagram uses them"
description: A fixture made from the Format page section of the same name.
---

## Animation: colour families, the way a diagram uses them

Colour marks what a thing *is*, and words stay readable: a family's colour goes on the border, the lines and the dots, with a light tint inside (`fill=soft`, the default) or none (`fill=none`, the border only); the words are always in ink. A container can be one family and hold things of other families: each keeps its own colour. A thing of the same family as its container drops the tint, so it stands out. Set `fill=` on one thing, or on the whole scene (`` ```animation fill=none ``). Here, letters go from post boxes (border only) through a sorting centre (one family) whose two machines are two other families.

```animation
family box "post boxes"
family sort "sorting centres"
family a "machine A"
family b "machine B"
family van "vans"
group boxes "post boxes" layout=column
box p1 "Hill Road" in boxes is=box fill=none
box p2 "Lake Street" in boxes is=box fill=none
box p3 "Market Square" in boxes is=box fill=none
group c1 "north centre" layout=row is=sort
box c1a "machine A" in c1 is=a size=s
box c1b "machine B" in c1 is=b size=s
group c2 "south centre" layout=row is=sort
box c2a "machine A" in c2 is=a size=s
box c2b "machine B" in c2 is=b size=s
group vans "vans" layout=column is=van
box v1 "van 1" in vans is=van
box v2 "van 2" in vans is=van
cylinder po "post office" is=van
p1 --> c1 is=box
p2 --> c1 is=box
p3 --> c2 is=box
c1 --> v1 is=sort
c2 --> v2 is=sort
v1 --> po is=van
v2 --> po is=van
@step Letters wait in three post boxes. The colours say what each thing is; the words stay in ink.
@step A collection takes the Hill Road letters to the north centre.
send "letters" p1 -> c1
@step Machine A reads the addresses. Machine B, another family inside the same centre, stands by.
highlight c1a
set c1b dim=yes
@step Machine A breaks down, and machine B takes over.
set c1a down=yes
set c1b dim=no
highlight c1b tone=good
@step The sorted letters go out to van 1.
send arrow "sorted" c1 -> v1
@step Van 1 takes them to the post office.
send both "delivery" v1 -> po
```
````

## Animation: eight colours, told apart by everyone

A scene can name up to eight families, and any two of them can stand side by side, so the eight colours are chosen by measurement, not by taste alone. Every pair differs in its **border** and in its **fill**, with normal sight and with the two common kinds of colour blindness (red-blind and green-blind, protanopia and deuteranopia, simulated). Every border is at least 3:1 against the stage and against any container it sits in; every word is at least 4.5:1 against what it sits on. A family has one fill for its boxes and its groups alike, and every border is at least 3:1 on any other family's fill, so a box of one family inside a group of another is still easy to see (one measured exception in light: the yellow family's olive border is 2.5:1 on the lilac, pink and green fills, where its own yellow fill marks its edge too). In dark a family writes its words in a light tint of its own colour. Light and dark each have their own eight, measured on their own backgrounds. Here all eight families share one scene, in two steps: one region (the services' family) holds things of four other families, and a worker of a fifth reads its queue from outside.

Animation, 2 steps. Starts with: person u "reader"; box cdn "CDN"; group region "one region" [box w1 "web", box s1 "orders service", box q1 "orders queue", cylinder db "orders DB", box c1 "cache"]; box k1 "worker". Connected: u -> cdn, cdn -> w1, w1 -> s1, s1 -> q1, q1 -> k1, k1 -> db, s1 -> c1. Families, one colour each: user "people" (u, u -> cdn); edge "the edge" (cdn, cdn -> w1); web "web servers" (w1, w1 -> s1); api "services" (region, s1, s1 -> q1, s1 -> c1); queue "queues" (q1, q1 -> k1); worker "workers" (k1, k1 -> db); store "databases" (db); cache "caches" (c1).

1. Eight families on one stage: each has its own border and its own fill.
2. The services' region holds four other families; the worker of a fifth reads its queue from outside.

Which colour a family gets is the theme's business: the source names families and roles, never a colour value. A host restyles the palette with the tokens `--c1` to `--c8` (border and lines), `--c1-soft` (the fill of its boxes and groups alike; `--c1-plane` names the same colour) and `--c1-ink` (words in the family's colour), and the stage's own edges with `--scn-edge`, `--scn-frame-edge` and `--scn-band-edge`.

#### Source: `fixtures/format/55a-animation-eight-colours-told-apart-by-everyone.dh.md`

````text
---
title: "Animation: eight colours, told apart by everyone"
description: A fixture made from the Format page section of the same name.
---

## Animation: eight colours, told apart by everyone

A scene can name up to eight families, and any two of them can stand side by side, so the eight colours are chosen by measurement, not by taste alone. Every pair differs in its **border** and in its **fill**, with normal sight and with the two common kinds of colour blindness (red-blind and green-blind, protanopia and deuteranopia, simulated). Every border is at least 3:1 against the stage and against any container it sits in; every word is at least 4.5:1 against what it sits on. A family has one fill for its boxes and its groups alike, and every border is at least 3:1 on any other family's fill, so a box of one family inside a group of another is still easy to see (one measured exception in light: the yellow family's olive border is 2.5:1 on the lilac, pink and green fills, where its own yellow fill marks its edge too). In dark a family writes its words in a light tint of its own colour. Light and dark each have their own eight, measured on their own backgrounds. Here all eight families share one scene, in two steps: one region (the services' family) holds things of four other families, and a worker of a fifth reads its queue from outside.

```animation
family user "people"
family edge "the edge"
family web "web servers"
family api "services"
family queue "queues"
family worker "workers"
family store "databases"
family cache "caches"
person u "reader" is=user
box cdn "CDN" is=edge
group region "one region" layout=row is=api
box w1 "web" in region is=web
box s1 "orders service" in region is=api
box q1 "orders queue" in region is=queue
box k1 "worker" is=worker
cylinder db "orders DB" in region is=store
box c1 "cache" in region is=cache
u -> cdn is=user
cdn -> w1 is=edge
w1 -> s1 is=web
s1 -> q1 is=api
q1 -> k1 is=queue
k1 -> db is=worker
s1 -> c1 is=api
@step Eight families on one stage: each has its own border and its own fill.
@step The services' region holds four other families; the worker of a fifth reads its queue from outside.
```

Which colour a family gets is the theme's business: the source names families and roles, never a colour value. A host restyles the palette with the tokens `--c1` to `--c8` (border and lines), `--c1-soft` (the fill of its boxes and groups alike; `--c1-plane` names the same colour) and `--c1-ink` (words in the family's colour), and the stage's own edges with `--scn-edge`, `--scn-frame-edge` and `--scn-band-edge`.
````

## Animation: streams, meters and colours

A `send stream` keeps small dots flowing along a path for the whole step: traffic, a feed, readings. `level=0..100` puts a meter in a thing, and `set x level=` moves it. Here, weather stations stream readings to a hub, which batches them into a store; the hub's buffer fills and empties.

Animation, 4 steps. Starts with: group field "stations" [box s1 "hill station", box s2 "lake station", box s3 "city station"]; box hub; cylinder db "readings store". Connected: s1 -> hub, s2 -> hub, s3 -> hub, hub -> db. Families, one colour each: st "stations" (s1, s2, s3); hub "the hub" (hub); store "the store" (db).

1. Three stations send a reading every few seconds. The hub keeps them in a buffer.
   s1 -> hub
   s2 -> hub
   s3 -> hub
2. A storm: the hill station sends ten times as often, and the buffer fills.
   s1 -> hub: storm: every second
   s2 -> hub
   s3 -> hub
3. The buffer is full: the hub writes one batch to the store and empties.
   hub -> db: batch of 600
4. Readings keep coming. When the buffer is full again, the next batch goes in: the store grows by a batch at a time.
   s1 -> hub
   s2 -> hub
   s3 -> hub
   hub -> db: next batch

#### Source: `fixtures/format/56-animation-streams-meters-and-colours.dh.md`

````text
---
title: "Animation: streams, meters and colours"
description: A fixture made from the Format page section of the same name.
---

## Animation: streams, meters and colours

A `send stream` keeps small dots flowing along a path for the whole step: traffic, a feed, readings. `level=0..100` puts a meter in a thing, and `set x level=` moves it. Here, weather stations stream readings to a hub, which batches them into a store; the hub's buffer fills and empties.

```animation
family st "stations"
family hub "the hub"
family store "the store"
group field "stations" layout=column
box s1 "hill station" in field is=st
box s2 "lake station" in field is=st
box s3 "city station" in field is=st
box hub "hub" is=hub level=10 note="keeps readings until it has a full batch"
cylinder db "readings store" is=store level=20 note="its meter: how full it is"
s1 -> hub
s2 -> hub
s3 -> hub
hub -> db
@step Three stations send a reading every few seconds. The hub keeps them in a buffer.
send stream s1 -> hub
send stream s2 -> hub
send stream s3 -> hub
set hub level=45
@step A storm: the hill station sends ten times as often, and the buffer fills.
send stream "storm: every second" s1 -> hub
send stream s2 -> hub
send stream s3 -> hub
set hub level=90 tone=warn
@step The buffer is full: the hub writes one batch to the store and empties.
send arrow "batch of 600" hub -> db
set hub level=5 tone=plain
set db level=40
@step Readings keep coming. When the buffer is full again, the next batch goes in: the store grows by a batch at a time.
send stream s1 -> hub
send stream s2 -> hub
send stream s3 -> hub
set hub level=90
then
send arrow "next batch" hub -> db
set hub level=5
set db level=60
```
````

## Animation: a balancer evens out the load

Meters on several things show a balance changing step by step. Here, a kitchen's three cooks get orders; a pass moves orders from the busiest cook to the least busy one.

Animation, 4 steps. Starts with: box pass "the pass"; group line "the line" [box c1 "grill", box c2 "salads", box c3 "pasta"]. Connected: pass -> c1, pass -> c2, pass -> c3. Families, one colour each: pass "the pass" (pass); cook "cooks" (c1, c2, c3).

1. Orders pile up at the grill; the salad cook is nearly idle.
2. The pass sends the next two orders to the salad cook instead.
   pass -> c2: 2 orders
3. The grill finishes what it had, and gets nothing new until it catches up.
4. The load is even: the three cooks now have about the same amount of work.

#### Source: `fixtures/format/57-animation-a-balancer-evens-out-the-load.dh.md`

````text
---
title: "Animation: a balancer evens out the load"
description: A fixture made from the Format page section of the same name.
---

## Animation: a balancer evens out the load

Meters on several things show a balance changing step by step. Here, a kitchen's three cooks get orders; a pass moves orders from the busiest cook to the least busy one.

```animation dir=down
family pass "the pass"
family cook "cooks"
box pass "the pass" is=pass note="the counter where orders are handed out"
group line "the line" layout=row
box c1 "grill" in line is=cook level=90
box c2 "salads" in line is=cook level=20
box c3 "pasta" in line is=cook level=40
pass -> c1
pass -> c2
pass -> c3
@step Orders pile up at the grill; the salad cook is nearly idle.
highlight c1 tone=hot
@step The pass sends the next two orders to the salad cook instead.
send both "2 orders" pass -> c2
set c2 level=45
@step The grill finishes what it had, and gets nothing new until it catches up.
set c1 level=60
@step The load is even: the three cooks now have about the same amount of work.
set c1 level=50
set c3 level=45
highlight c1 c2 c3 tone=good
```
````

## Animation: one question becomes three

`split` and `merge` with arrows show one request fanning out and coming back together. Here, a library search asks three branch catalogues at once and merges their answers.

Animation, 4 steps. Starts with: pill ask "find: tide tables"; box planner; group branches [cylinder b1 "north branch", cylinder b2 "harbour branch", cylinder b3 "old town branch"]; box merge "merger". Connected: ask -> planner, planner -> b1, planner -> b2, planner -> b3, b1 -> merge, b2 -> merge, b3 -> merge. Families, one colour each: q "the question" (ask, planner, merge); br "branch catalogues" (b1, b2, b3).

1. A reader asks for tide tables. The planner sees that three branches keep them.
   ask -> planner
2. The planner asks all three branches at once.
   planner -> b1: same question
   planner -> b2
   planner -> b3
3. Each branch answers with what it has; the old town branch has nothing.
   b1 -> merge: 2 books
   b2 -> merge: 5 books
4. The merger joins the answers into one list for the reader.

#### Source: `fixtures/format/58-animation-one-question-becomes-three.dh.md`

````text
---
title: "Animation: one question becomes three"
description: A fixture made from the Format page section of the same name.
---

## Animation: one question becomes three

`split` and `merge` with arrows show one request fanning out and coming back together. Here, a library search asks three branch catalogues at once and merges their answers.

```animation
family q "the question"
family br "branch catalogues"
pill ask "find: tide tables" is=q
box planner "planner" is=q note="splits a search by branch"
group branches "branches" layout=column
cylinder b1 "north branch" in branches is=br
cylinder b2 "harbour branch" in branches is=br
cylinder b3 "old town branch" in branches is=br
box merge "merger" is=q
ask -> planner
planner -> b1
planner -> b2
planner -> b3
b1 -> merge
b2 -> merge
b3 -> merge
@step A reader asks for tide tables. The planner sees that three branches keep them.
send arrow ask -> planner
@step The planner asks all three branches at once.
send arrow "same question" planner -> b1
send arrow planner -> b2
send arrow planner -> b3
@step Each branch answers with what it has; the old town branch has nothing.
send both "2 books" b1 -> merge
send both "5 books" b2 -> merge
set b3 dim=yes
@step The merger joins the answers into one list for the reader.
highlight merge
say merge below: 7 books, by date
```
````

## Animation: the author sets the beat

Format version 9 gives the author more say over motion, still with no times or pixels. `then` starts the next beat of a step: what comes after it waits for what came before. `pace slow` or `pace fast` sets a step's speed. `spotlight` dims everything else for one step. `say cache below: …` says where the speech goes. `path=arc` makes a move travel over an arc. Things a step does not change never move.

Animation, 4 steps. Starts with: person u "reader"; group app "web app" [box h "handler"]; box cache; cylinder db "database"; group tray "pages ready". Connected: u -> app, app -> cache, app -> db. Families, one colour each: app "the app" (app, h); data (cache, db).

1. A reader asks the web app for a page.
   u -> app: GET /a
2. The app looks in the cache; then the cache answers.
   app -> cache: find /a
3. So the app reads the database. The pace is slow, so the wait shows.
   app -> db: read /a
4. The handler builds the page; then it moves over to the pages that are ready.

#### Source: `fixtures/format/59-animation-the-author-sets-the-beat.dh.md`

````text
---
title: "Animation: the author sets the beat"
description: A fixture made from the Format page section of the same name.
---

## Animation: the author sets the beat

Format version 9 gives the author more say over motion, still with no times or pixels. `then` starts the next beat of a step: what comes after it waits for what came before. `pace slow` or `pace fast` sets a step's speed. `spotlight` dims everything else for one step. `say cache below: …` says where the speech goes. `path=arc` makes a move travel over an arc. Things a step does not change never move.

```animation
family app "the app"
family data "data"
person u "reader"
group app "web app" layout=column is=app
box h "handler" in app is=app
box cache "cache" is=data
cylinder db "database" is=data
group tray "pages ready" layout=row
u -> app
app -> cache
app -> db
@step A reader asks the web app for a page.
send "GET /a" u -> app
@step The app looks in the cache; then the cache answers.
spotlight app cache
send "find /a" app -> cache
then
say cache below: not here
@step So the app reads the database. The pace is slow, so the wait shows.
pace slow
send "read /a" app -> db
@step The handler builds the page; then it moves over to the pages that are ready.
add box page "page /a" in app is=app
then
move page to tray path=arc
```
````

## Animation by a new author: a queue with workers

Written from the spec alone by a helper that had not seen the engine; doccheck passed it on the first try.

Animation, 6 steps. Starts with: box api "API"; queue q "jobs": empty; group w1 "worker 1"; group w2 "worker 2". Connected: api -> q, q -> w1, q -> w2.

1. The API adds three jobs to the queue.
2. Worker 1 takes the oldest job from the front.
3. Worker 2 takes the next job.
4. Worker 1 finishes job 1, so the job is gone.
5. Worker 1 takes the next job in line.
6. The API keeps adding work while the workers run.

#### Source: `fixtures/format/60-animation-by-a-new-author-a-queue-with-workers.dh.md`

````text
---
title: "Animation by a new author: a queue with workers"
description: A fixture made from the Format page section of the same name.
---

## Animation by a new author: a queue with workers

Written from the spec alone by a helper that had not seen the engine; doccheck passed it on the first try.

```animation
box api "API"
queue q "jobs"
group w1 "worker 1" layout=row
group w2 "worker 2" layout=row
api -> q
q -> w1
q -> w2
@step The API adds three jobs to the queue.
push q "job 1" as j1
push q "job 2" as j2
push q "job 3" as j3
@step Worker 1 takes the oldest job from the front.
pop q to w1
@step Worker 2 takes the next job.
pop q to w2
@step Worker 1 finishes job 1, so the job is gone.
remove j1
say w1: done!
@step Worker 1 takes the next job in line.
pop q to w1
@step The API keeps adding work while the workers run.
push q "job 4" as j4
```
````

## Animation by a new author: a CDN miss, then a hit

The second scene from the same first try.

Animation, 7 steps. Starts with: person u1 "user 1"; group edge "CDN edge"; cylinder origin "origin server". Connected: u1 <-> edge, edge <-> origin.

1. User 1 asks the CDN edge for logo.png.
   u1 -> edge: GET logo.png
2. The edge has no copy: a miss.
3. The edge fetches the file from the origin server.
   edge -> origin: GET logo.png
4. The origin answers, and the edge keeps a copy.
   origin -> edge: logo.png
5. The edge answers user 1.
   edge -> u1: logo.png
6. User 2 asks the edge for the same file.
   u2 -> edge: GET logo.png
7. The edge has a copy: a hit. It answers at once, with no trip to the origin.
   edge -> u2: logo.png

#### Source: `fixtures/format/61-animation-by-a-new-author-a-cdn-miss-then-a-hit.dh.md`

````text
---
title: "Animation by a new author: a CDN miss, then a hit"
description: A fixture made from the Format page section of the same name.
---

## Animation by a new author: a CDN miss, then a hit

The second scene from the same first try.

```animation
person u1 "user 1"
group edge "CDN edge" layout=row
cylinder origin "origin server" note="holds the original file"
u1 <-> edge
edge <-> origin
@step User 1 asks the CDN edge for logo.png.
send "GET logo.png" u1 -> edge
@step The edge has no copy: a miss.
say edge: Miss!
highlight edge tone=warn
@step The edge fetches the file from the origin server.
send "GET logo.png" edge -> origin
camera edge origin
@step The origin answers, and the edge keeps a copy.
send "logo.png" origin -> edge
add box copy "logo.png" in edge
@step The edge answers user 1.
send "logo.png" edge -> u1
camera all
@step User 2 asks the edge for the same file.
add person u2 "user 2"
u2 <-> edge
send "GET logo.png" u2 -> edge
@step The edge has a copy: a hit. It answers at once, with no trip to the origin.
say edge: Hit!
highlight copy tone=good
send "logo.png" edge -> u2
camera edge u2
```
````

## Animation: one thing splits, travels and merges

A token can be cut into pieces and put back together. `split f into 3 "part"` makes three tokens, `f.1` to `f.3` ("part 1" to "part 3"), where `f` was. `move f.1 f.2 f.3 into b` moves them together, as one hop. `merge f` puts the pieces back into `f`. A token can sit at a thing (`token t "req" at api`) or wait in a container (`token f "photo.jpg" in a`).

Animation, 4 steps. Starts with: group a "sender" [token f "photo.jpg"]; group b "receiver". Connected: a -> b.

1. The sender has a file that is too big for one packet.
2. It is split into three parts.
   f splits into: part 1, part 2, part 3
3. The parts travel together: one hop.
   a -> b: part 1, part 2, part 3
4. The receiver joins them back into the file.
   part 1, part 2, part 3 merge into f: photo.jpg

#### Source: `fixtures/format/62-animation-one-thing-splits-travels-and-merges.dh.md`

````text
---
title: "Animation: one thing splits, travels and merges"
description: A fixture made from the Format page section of the same name.
---

## Animation: one thing splits, travels and merges

A token can be cut into pieces and put back together. `split f into 3 "part"` makes three tokens, `f.1` to `f.3` ("part 1" to "part 3"), where `f` was. `move f.1 f.2 f.3 into b` moves them together, as one hop. `merge f` puts the pieces back into `f`. A token can sit at a thing (`token t "req" at api`) or wait in a container (`token f "photo.jpg" in a`).

```animation
group a "sender" layout=column
group b "receiver" layout=column
a -> b
token f "photo.jpg" in a
@step The sender has a file that is too big for one packet.
highlight f
@step It is split into three parts.
split f into 3 "part"
@step The parts travel together: one hop.
move f.1 f.2 f.3 into b
@step The receiver joins them back into the file.
merge f
```
````

## Animation: an array, a map and a tree in one scene

Data structures are things like any other, and live in one scene with a person, a service and a database. Each is `closed=yes`: small and faint until the story zooms into it. `map cart "cart sizes" buckets=3: ana: 3, ...` is a map of keys and values, drawn as a hash table: a key's bucket is the sum of its letters' codes, mod 3. `get cart ana` looks a key up (its entry lights up, and its bucket is framed), `get ids 3` reads an array by index, and `put cart dee: 4` adds an entry. `dir=down` on the fence runs the scene top to bottom. Without `buckets=`, a map is a table of keys and values.

Animation, 11 steps. Starts with: person ana "Ana"; group api "orders service" [array ids "sorted ids": 12, 19, 27, 34, map cart "cart sizes" closed, 3 buckets, a key's bucket is the sum of its letters' codes mod 3: ben: 7 (bucket 0), ana: 3 (bucket 1), cy: 9 (bucket 1), tree idx "price index" closed [pill p30 "30", pill p20 "20" under p30 left, pill p50 "50" under p30 right, pill p40 "40" under p50 left]]; cylinder db "orders database". Connected: ana -> api, api -> db. Families, one colour each: svc "the service" (api); data "its data" (ids, cart, idx).

1. Ana asks for her orders. The service keeps three structures in memory.
2. Zoom into the array: four ids, sorted.
   zoom into ids
3. Index 3 is read at once: 34. No search.
   get ids 3 -> 34
4. Now the map. A key's bucket: the sum of its letters' codes, mod 3.
   zoom out of ids
   zoom into cart
5. ana goes to bucket 1, which cy shares (a chain). Its value: 3 items.
   get cart ana -> 3 (bucket 1)
6. A new key, dee, goes to bucket 2.
   put cart dee: 4
7. Now the tree: smaller prices go left, bigger right.
   zoom out of cart
   zoom into idx
8. Find 40: at the root, 30, go right.
9. At 50, go left.
10. 40 is found.
11. Back out: the service answered from memory, not the database.
   zoom out of idx

#### Source: `fixtures/format/63-animation-an-array-a-map-and-a-tree-in-one-scene.dh.md`

````text
---
title: "Animation: an array, a map and a tree in one scene"
description: A fixture made from the Format page section of the same name.
---

## Animation: an array, a map and a tree in one scene

Data structures are things like any other, and live in one scene with a person, a service and a database. Each is `closed=yes`: small and faint until the story zooms into it. `map cart "cart sizes" buckets=3: ana: 3, ...` is a map of keys and values, drawn as a hash table: a key's bucket is the sum of its letters' codes, mod 3. `get cart ana` looks a key up (its entry lights up, and its bucket is framed), `get ids 3` reads an array by index, and `put cart dee: 4` adds an entry. `dir=down` on the fence runs the scene top to bottom. Without `buckets=`, a map is a table of keys and values.

```animation dir=down size=s
family svc "the service"
family data "its data"
person ana "Ana"
group api "orders service" layout=row is=svc
array ids "sorted ids" in api closed=yes is=data: 12, 19, 27, 34
map cart "cart sizes" in api buckets=3 closed=yes is=data: ana: 3, ben: 7, cy: 9
tree idx "price index" in api closed=yes is=data
pill p30 "30" in idx
pill p20 "20" in idx under p30 left
pill p50 "50" in idx under p30 right
pill p40 "40" in idx under p50 left
cylinder db "orders database"
ana -> api
api -> db
@step Ana asks for her orders. The service keeps three structures in memory.
say ana: my orders, please
@step Zoom into the array: four ids, sorted.
zoom into ids
@step Index 3 is read at once: 34. No search.
get ids 3
@step Now the map. A key's bucket: the sum of its letters' codes, mod 3.
zoom out
then
zoom into cart
@step ana goes to bucket 1, which cy shares (a chain). Its value: 3 items.
get cart ana
@step A new key, dee, goes to bucket 2.
put cart dee: 4
@step Now the tree: smaller prices go left, bigger right.
zoom out
then
zoom into idx
@step Find 40: at the root, 30, go right.
highlight p30
@step At 50, go left.
highlight p50
@step 40 is found.
highlight p40 tone=good
@step Back out: the service answered from memory, not the database.
zoom out
say ana: that was fast
```
````

## 3D: the stateless replay system in layers

Format version 5 adds **layers**. `layer co "coordinator"` declares one (the first is the top), and `layer=co` puts a thing on it; a thing without `layer=` sits on its container's layer. `split layers` pulls the layers apart, `stack layers` puts them back, and `focus tc` flies the camera to one layer while the others fade. A fence written `` ```animation 3d `` opens the scene in 3D; the **2D/3D** button on every stage switches and keeps the step. In 3D: drag to turn; right-drag, Shift + drag or two fingers to move; the wheel, a pinch or + and − to zoom; once you click the stage, the arrow keys and W A S D move too. Click a thing for its note or a layer to zoom into it; the reset button puts the camera back. Here, one call goes down from the CLI to the template container and the answer comes back up.

Animation, 13 steps. Starts with: group cli "CLI" [text a0 "no answers yet"]; box coord "coordinator"; group box1 "template container" [text t0 "keeps nothing"]; cylinder img "template image". Connected: cli -> coord, coord -> box1, img --> coord. Layers, top to bottom: you "your machine" (cli); co "coordinator" (coord); tc "template container" (box1); reg "registry" (img). Families, one colour each: you "CLI" (cli); co "coordinator" (coord); tc "template container" (box1); reg "registry" (img).

1. Four layers: your CLI, the coordinator, the template container, and the registry.
2. First the coordinator pulls the template's image.
   img -> coord: image
3. It starts the template container from it.
   coord -> box1: start
4. Init call 1 goes down: the CLI calls the coordinator. It carries no answers.
   cli -> coord: init 1 · no answers
5. The coordinator forwards the call to the template container.
   coord -> box1: init 1
6. The script makes project id A and stops at its first unanswered question.
7. The question and the state go back up. The container keeps nothing.
   box1 -> coord: question: name · state: A
8. The coordinator hands them to the CLI.
   coord -> cli: question · state A
9. The container's layer alone: no answer, no session, no paused script.
10. You type hello-app. The CLI keeps it, and project id A.
11. Call 2 carries both down to the coordinator.
   cli -> coord: init 2 · name, A
12. It forwards call 2. The script runs again from line 1, past the name.
   coord -> box1: init 2
13. Every call goes down and back this way. Only the CLI holds the answers.

#### Source: `fixtures/format/64-3d-the-stateless-replay-system-in-layers.dh.md`

````text
---
title: "3D: the stateless replay system in layers"
description: A fixture made from the Format page section of the same name.
---

## 3D: the stateless replay system in layers

Format version 5 adds **layers**. `layer co "coordinator"` declares one (the first is the top), and `layer=co` puts a thing on it; a thing without `layer=` sits on its container's layer. `split layers` pulls the layers apart, `stack layers` puts them back, and `focus tc` flies the camera to one layer while the others fade. A fence written `` ```animation 3d `` opens the scene in 3D; the **2D/3D** button on every stage switches and keeps the step. In 3D: drag to turn; right-drag, Shift + drag or two fingers to move; the wheel, a pinch or + and − to zoom; once you click the stage, the arrow keys and W A S D move too. Click a thing for its note or a layer to zoom into it; the reset button puts the camera back. Here, one call goes down from the CLI to the template container and the answer comes back up.

```animation 3d
layer you "your machine"
layer co "coordinator"
layer tc "template container"
layer reg "registry"
family you "CLI"
family co "coordinator"
family tc "template container"
family reg "registry"
group cli "CLI" layer=you layout=column is=you
text a0 "no answers yet" in cli tone=muted
box coord "coordinator" layer=co is=co note="starts templates in Docker and forwards each call"
group box1 "template container" layer=tc layout=column is=tc note="runs the script; keeps nothing"
text t0 "keeps nothing" in box1 tone=muted
cylinder img "template image" layer=reg is=reg
cli -> coord -> box1
img --> coord
@step Four layers: your CLI, the coordinator, the template container, and the registry.
split layers
@step First the coordinator pulls the template's image.
send arrow "image" img -> coord
@step It starts the template container from it.
send arrow "start" coord -> box1
@step Init call 1 goes down: the CLI calls the coordinator. It carries no answers.
send arrow "init 1 · no answers" cli -> coord
@step The coordinator forwards the call to the template container.
send arrow "init 1" coord -> box1
@step The script makes project id A and stops at its first unanswered question.
add pill p1 "project-id A" in box1 tone=acc
say box1: no answer for name
@step The question and the state go back up. The container keeps nothing.
send arrow "question: name · state: A" box1 -> coord
remove p1
@step The coordinator hands them to the CLI.
send arrow "question · state A" coord -> cli
@step The container's layer alone: no answer, no session, no paused script.
focus tc
@step You type hello-app. The CLI keeps it, and project id A.
focus all
remove a0
add pill a1 "name = hello-app" in cli tone=good
add pill a2 "project-id A" in cli tone=acc
@step Call 2 carries both down to the coordinator.
send arrow "init 2 · name, A" cli -> coord
@step It forwards call 2. The script runs again from line 1, past the name.
send arrow "init 2" coord -> box1
@step Every call goes down and back this way. Only the CLI holds the answers.
stack layers
highlight cli
```
````

## 3D: Kubernetes, cluster to container

Boxes inside boxes: a cluster box holds node boxes, a node holds pod boxes, a pod holds its containers. This is a tree that only works in 3D, so the fence says `3d only` and the stage has no 2D button. Every level starts `closed=hidden`: nothing inside it is drawn until `zoom into` opens it, so each step talks about one level and the smaller boxes stay out of the way. Zooms nest (`zoom into n1`, then `zoom into p2`), and each zoom pulls the box it opens up out of the one that holds it (`lift n1`, then `lift p2`: lifts nest too). `lift k3` pulls redis up out of its pod to focus on it, `put back` sets it down again, and `zoom out` and `zoom out all` close the levels one at a time or all at once, putting each box back where it was. While a step plays, only the labels of what it touches show: here, redis alone as the camera flies to it.

Animation, 8 steps, 3D only. Starts with: group c "cluster" [group n1 "node 1" closed, inside hidden [group p1 "web-1" closed, inside hidden [box k1 "nginx", box k2 "log agent"], group p2 "cache-1" closed, inside hidden [box k3 "redis"]], group n2 "node 2" closed, inside hidden [group p3 "web-2" closed, inside hidden [box k4 "nginx", box k5 "log agent"]]].

1. One cluster box holds two node boxes. What runs on the nodes is hidden: at this level we talk about machines.
2. Zoom into node 1: it rises out of the cluster, and its pod boxes appear, web-1 and cache-1. Node 2 fades.
   zoom into n1: its inside appears, the rest fades
   lift n1 out of c
3. Zoom into cache-1: it rises out of node 1, its box opens, and its one container shows, redis.
   zoom into p2: its inside appears, the rest fades
   lift p2 out of n1
4. Pull redis up out of its pod to focus on it. While the camera flies in, only its label shows.
   lift k3 out of p2
5. The redis container crashes.
6. The kubelet on node 1 starts it again, back in the same pod. The pod and the node stay as they were.
   put back k3
7. Zoom out to node 1: cache-1 settles back into the node and closes again; its container hides.
   zoom out of p2
   p2 settle back into place
8. Zoom out all the way: node 1 settles back into the cluster. The smaller boxes hide, and we are back to talking about machines.
   zoom out all the way
   n1 settle back into place

#### Source: `fixtures/format/65-3d-kubernetes-cluster-to-container.dh.md`

````text
---
title: "3D: Kubernetes, cluster to container"
description: A fixture made from the Format page section of the same name.
---

## 3D: Kubernetes, cluster to container

Boxes inside boxes: a cluster box holds node boxes, a node holds pod boxes, a pod holds its containers. This is a tree that only works in 3D, so the fence says `3d only` and the stage has no 2D button. Every level starts `closed=hidden`: nothing inside it is drawn until `zoom into` opens it, so each step talks about one level and the smaller boxes stay out of the way. Zooms nest (`zoom into n1`, then `zoom into p2`), and each zoom pulls the box it opens up out of the one that holds it (`lift n1`, then `lift p2`: lifts nest too). `lift k3` pulls redis up out of its pod to focus on it, `put back` sets it down again, and `zoom out` and `zoom out all` close the levels one at a time or all at once, putting each box back where it was. While a step plays, only the labels of what it touches show: here, redis alone as the camera flies to it.

```animation 3d only
group c "cluster"
group n1 "node 1" in c closed=hidden
group n2 "node 2" in c closed=hidden
group p1 "web-1" in n1 closed=hidden
group p2 "cache-1" in n1 closed=hidden
group p3 "web-2" in n2 closed=hidden
box k1 "nginx" in p1
box k2 "log agent" in p1
box k3 "redis" in p2
box k4 "nginx" in p3
box k5 "log agent" in p3
note n1: a machine; the kubelet on it runs the pods it is given
note p2: the unit the scheduler places; its containers share one network address
@step One cluster box holds two node boxes. What runs on the nodes is hidden: at this level we talk about machines.
camera all
@step Zoom into node 1: it rises out of the cluster, and its pod boxes appear, web-1 and cache-1. Node 2 fades.
zoom into n1
lift n1
camera n1
@step Zoom into cache-1: it rises out of node 1, its box opens, and its one container shows, redis.
zoom into p2
lift p2
camera p2
@step Pull redis up out of its pod to focus on it. While the camera flies in, only its label shows.
lift k3
camera k3
@step The redis container crashes.
set k3 down=yes
highlight k3 tone=hot
@step The kubelet on node 1 starts it again, back in the same pod. The pod and the node stay as they were.
put back k3
remove k3
add box k3b "redis" in p2 tone=good
camera p2
@step Zoom out to node 1: cache-1 settles back into the node and closes again; its container hides.
zoom out
@step Zoom out all the way: node 1 settles back into the cluster. The smaller boxes hide, and we are back to talking about machines.
zoom out all
```
````

## Animation: a packet through kube-proxy

Two nodes and the VPC under them, drawn flat so every word reads: each node shows its pods, its kernel and its network card, and every step is drawn at one fixed place. `layout=row` puts the nodes side by side with the VPC between them; on a phone they stack, node 1 above the VPC above node 2. The call takes the real path: the frontend's veth, node 1's kernel, where a rule kube-proxy wrote rewrites the service's virtual IP to one pod's IP (kube-proxy itself never carries the packet), node 1's network card, the VPC, node 2's network card and kernel, web-2's veth. The reply comes back the same way, and node 1's conntrack undoes the rewrite.

Animation, 22 steps, flat. Node 1 (frontend pod 198.51.100.4, kube-proxy; kernel with the frontend's veth, the iptables rules, conntrack; network card), the VPC, node 2 (web-2 198.51.100.7, kube-proxy; kernel with web-2's veth and routes; network card). kube-proxy only writes the rules.

1. to 4. The nodes and the VPC; kube-proxy writes rules on every node; the frontend calls the service at 192.0.2.10, a virtual IP.
5. to 8. Veth, node 1's kernel: a rule rewrites the destination to 198.51.100.7, conntrack notes it, node 1 routes it out of its card.
9. to 13. The VPC (AWS VPC CNI: the IP belongs to node 2's card) delivers it; node 2's kernel routes it through the veth into web-2. No second rewrite.
14. to 22. The reply comes back the same hops; node 1's conntrack restores the source 192.0.2.10. A routed CNI or an overlay would do the middle hop instead.

#### Source: `fixtures/format/66-animation-a-packet-through-kube-proxy.dh.md`

````text
---
title: "Animation: a packet through kube-proxy"
description: A fixture made from the Format page section of the same name.
---

## Animation: a packet through kube-proxy

Two nodes and the VPC under them, drawn flat so every word reads: each node shows its pods, its kernel and its network card, and every step is drawn at one fixed place. `layout=row` puts the nodes side by side with the VPC between them; on a phone they stack, node 1 above the VPC above node 2. The call takes the real path: the frontend's veth, node 1's kernel, where a rule kube-proxy wrote rewrites the service's virtual IP to one pod's IP (kube-proxy itself never carries the packet), node 1's network card, the VPC, node 2's network card and kernel, web-2's veth. The reply comes back the same way, and node 1's conntrack undoes the rewrite.

```animation layout=row
family pod "pods"
family kp "kube-proxy"
family kern "node kernels"
family net "network cards and the VPC"
group n1 "node 1" layout=column note="node IP 198.51.100.21"
group n1p in n1 layout=row
box fe "frontend" in n1p is=pod note="a pod; pod IP 198.51.100.4"
box kp1 "kube-proxy" in n1p is=kp note="runs on every node; watches the API for services and their pods, and writes the rules. It never carries a packet"
group n1k "kernel" in n1 layout=row is=kern
box v1 "veth" in n1k is=kern size=s note="the frontend's veth: a cable with one end in the pod and one in the node"
box r1 "rules" in n1k is=kern size=s note="the iptables rules kube-proxy wrote: every packet to 192.0.2.10 meets them"
box ct1 "conntrack" in n1k is=kern size=s note="remembers each rewrite, to undo it on the reply"
box e1 "network card" in n1 is=net note="eth0, node 1's network card"
box vr "VPC" is=net note="the network under the cluster. Its route table: 198.51.100.0/24 is local. With AWS's VPC CNI, web-2's IP 198.51.100.7 is a second address of node 2's network card"
group n2 "node 2" layout=column note="node IP 198.51.100.22"
group n2p in n2 layout=row
box w2 "web-2" in n2p is=pod note="a pod of the service web; pod IP 198.51.100.7"
box kp2 "kube-proxy" in n2p is=kp note="the same on every node"
group n2k "kernel" in n2 layout=row is=kern
box v2 "veth" in n2k is=kern size=s note="web-2's veth"
box rt2 "routes" in n2k is=kern size=s note="198.51.100.7 is a pod on this node: through web-2's veth"
box e2 "network card" in n2 is=net note="eth0, node 2's network card"
e1 -> vr
vr -> e2
@step Two nodes and the VPC, the network under them.
@step On each node: its pods at the top, its kernel, and its network card at the bottom, where packets leave and enter the node.
@step kube-proxy runs on every node. It watches the API for the service web and writes rules into the kernel's iptables. It never carries a packet.
highlight kp1
@step The frontend calls the service web at 192.0.2.10. No pod and no machine has that address: it lives only in rules.
highlight fe
@step The packet leaves the frontend through its veth, into node 1's kernel.
send fe -> v1
@step In node 1's kernel it meets the rules kube-proxy wrote. kube-proxy itself never touches the packet.
send "to 192.0.2.10" v1 -> r1
@step A rule picks one of the service's pods at random, web-2, and rewrites the destination to its IP. conntrack writes the rewrite down.
say r1 above: → 198.51.100.7
highlight r1
@step 198.51.100.7 is not on node 1, so node 1's kernel routes the packet out of its own network card.
send r1 -> e1
@step The packet enters the VPC. Its route table knows 198.51.100.7: on AWS's VPC CNI, it is an address of node 2's network card.
send "to 198.51.100.7" e1 -> vr
say vr above: 198.51.100.7 → node 2
@step The VPC delivers it to node 2's network card. No tunnel and no rewrite on the way.
send vr -> e2
@step Node 2's kernel looks up its routes: 198.51.100.7 is a pod on this node.
send e2 -> rt2
@step The route sends it into web-2's veth.
send rt2 -> v2
@step Through the veth into web-2. No second rewrite: the address is already a pod's.
send v2 -> w2
@step web-2 answers from 198.51.100.7, back into its veth.
send w2 -> v2
@step Into node 2's kernel, which routes the reply toward 198.51.100.4.
send "200 OK" v2 -> rt2
@step Out of node 2's network card.
send rt2 -> e2
@step Into the VPC: 198.51.100.4 is an address of node 1's network card.
send "200 OK" e2 -> vr
@step The VPC delivers it to node 1's network card.
send "200 OK" vr -> e1
@step Into node 1's kernel, where conntrack knows this reply: it belongs to the rewrite it wrote down.
send e1 -> ct1
@step conntrack undoes the rewrite: the source 198.51.100.7 becomes 192.0.2.10 again.
highlight ct1
@step Out of node 1's kernel into the frontend's veth.
send "from 192.0.2.10" ct1 -> v1
@step Into the frontend, which sees the service answer. Other networks under a cluster do the middle hop another way: a routed CNI has a route "node 2's pod range → node 2"; an overlay wraps the packet from node IP to node IP. The kube-proxy part stays the same.
send v1 -> fe
```

:::llm
Animation, 22 steps, flat. Node 1 (frontend pod 198.51.100.4, kube-proxy; kernel with the frontend's veth, the iptables rules, conntrack; network card), the VPC, node 2 (web-2 198.51.100.7, kube-proxy; kernel with web-2's veth and routes; network card). kube-proxy only writes the rules.

1. to 4. The nodes and the VPC; kube-proxy writes rules on every node; the frontend calls the service at 192.0.2.10, a virtual IP.
5. to 8. Veth, node 1's kernel: a rule rewrites the destination to 198.51.100.7, conntrack notes it, node 1 routes it out of its card.
9. to 13. The VPC (AWS VPC CNI: the IP belongs to node 2's card) delivers it; node 2's kernel routes it through the veth into web-2. No second rewrite.
14. to 22. The reply comes back the same hops; node 1's conntrack restores the source 192.0.2.10. A routed CNI or an overlay would do the middle hop instead.
:::
````

## 3D: a request through the network layers

Two machines with the same five layers. When top-level things sit on two or more layers, the 2D stage draws one band per layer and lines up each band's things in columns, so the two stacks stand side by side.

Animation, 12 steps. Starts with: box a1 "browser"; box b1 "web server"; box a2 "encrypt"; box b2 "decrypt"; box a3 "segments"; box b3 "segments"; box a4 "packets"; box b4 "packets"; box a5 "Wi-Fi"; box b5 "Ethernet". Connected: a1 -> a2, a2 -> a3, a3 -> a4, a4 -> a5, b5 -> b4, b4 -> b3, b3 -> b2, b2 -> b1, a5 -> b5 "the wire". Layers, top to bottom: app "application" (a1, b1); tls "TLS" (a2, b2); tcp "TCP" (a3, b3); ip "IP" (a4, b4); link (a5, b5). Families, one colour each: cl "the browser's machine" (a1, a2, a3, a4, a5); sv "the server's machine" (b1, b2, b3, b4, b5).

1. A browser on one machine asks a web server on another for a page. Each machine has the same five layers.
2. Going down: TLS encrypts the request.
   a1 -> a2: GET /
3. TCP cuts it into numbered segments.
   a2 -> a3: encrypted
4. IP addresses each one: packets.
   a3 -> a4: segments
5. The link layer makes them signals.
   a4 -> a5: packets
6. The signals cross the wire to the other machine.
   a5 -> b5: bits
7. Going up, each layer undoes its twin's work: to IP.
   b5 -> b4: bits
8. IP hands the segments to TCP.
   b4 -> b3: packets
9. TCP puts them in order, for TLS.
   b3 -> b2: segments
10. TLS decrypts the request, and the web server reads it.
   b2 -> b1: GET /
11. Look at one layer: TCP on both machines talks only to TCP. The layers above and below are its tools.
12. The web server's reply goes back to the browser the same way, one layer per hop.

#### Source: `fixtures/format/67-3d-a-request-through-the-network-layers.dh.md`

````text
---
title: "3D: a request through the network layers"
description: A fixture made from the Format page section of the same name.
---

## 3D: a request through the network layers

Two machines with the same five layers. When top-level things sit on two or more layers, the 2D stage draws one band per layer and lines up each band's things in columns, so the two stacks stand side by side.

```animation 3d
layer app "application"
layer tls "TLS"
layer tcp "TCP"
layer ip "IP"
layer link "link"
family cl "the browser's machine"
family sv "the server's machine"
box a1 "browser" layer=app is=cl
box b1 "web server" layer=app is=sv
box a2 "encrypt" layer=tls is=cl
box b2 "decrypt" layer=tls is=sv
box a3 "segments" layer=tcp is=cl
box b3 "segments" layer=tcp is=sv
box a4 "packets" layer=ip is=cl
box b4 "packets" layer=ip is=sv
box a5 "Wi-Fi" layer=link is=cl note="the laptop's network card"
box b5 "Ethernet" layer=link is=sv note="the server's network card"
a1 -> a2 -> a3 -> a4 -> a5
b5 -> b4 -> b3 -> b2 -> b1
a5 -> b5 "the wire"
@step A browser on one machine asks a web server on another for a page. Each machine has the same five layers.
split layers
@step Going down: TLS encrypts the request.
send "GET /" a1 -> a2
@step TCP cuts it into numbered segments.
send "encrypted" a2 -> a3
camera a3 close turn=left
@step IP addresses each one: packets.
send "segments" a3 -> a4
camera a4 close turn=left
@step The link layer makes them signals.
send "packets" a4 -> a5
camera a5 close turn=left tilt=low
@step The signals cross the wire to the other machine.
send "bits" a5 -> b5
camera a5 b5 turn=front tilt=low
@step Going up, each layer undoes its twin's work: to IP.
send "bits" b5 -> b4
camera all
@step IP hands the segments to TCP.
send "packets" b4 -> b3
@step TCP puts them in order, for TLS.
send "segments" b3 -> b2
@step TLS decrypts the request, and the web server reads it.
send "GET /" b2 -> b1
@step Look at one layer: TCP on both machines talks only to TCP. The layers above and below are its tools.
focus tcp
highlight a3 b3
@step The web server's reply goes back to the browser the same way, one layer per hop.
focus all
stack layers
highlight b1 a1 tone=good
say b1: 200 OK
```
````

## 3D: a message through a router, in segments

A thing can have an inside. `group r "router" closed=yes` draws the router's inside faint and without words; `zoom into r` flies the camera in and opens it, and `zoom out` closes it again. Inside, a queue holds tokens: `move ... into q` puts them at its back, and `pop q to p2` takes the front one out. `drop msg.4 at q` sends a token there and loses it, the way a full router drops a packet. Here, TCP cuts a message into segments, a router forwards them, one is lost and sent again, and host B puts the message back together.

Animation, 13 steps. Starts with: group ha "host A" [token msg "message"]; group r "router" closed [queue q "input queue": empty, table rt: to, port, group p2 "port 2"]; group hb "host B". Connected: ha -> q, p2 -> hb. Layers, top to bottom: net "one network" (ha, r, hb). Families, one colour each: a "host A" (ha, msg); b "host B" (hb); rr "router" (r, q, rt, p2).

1. Host A has one message for host B: too big for one packet.
2. TCP cuts it into four numbered segments.
   msg splits into: seg 1, seg 2, seg 3, seg 4
3. Zoom into the router: an input queue, a routing table, and port 2.
   zoom into r
4. The segments arrive. The queue holds three; segment 4 finds it full.
   ha -> q: seg 1, seg 2, seg 3
   ha -> q: seg 4, dropped there (lost)
5. The routing table says host B is behind port 2.
6. The oldest segment leaves the queue for port 2.
   q -> p2: seg 1
7. The next one follows; segment 3 waits its turn.
   q -> p2: seg 2
8. Zoom out: segments 1 and 2 cross the wire to host B.
   zoom out of r
   p2 -> hb: seg 1, seg 2
9. Segment 3 follows them.
   q -> hb: seg 3
10. Host B has 1, 2 and 3, but not 4. Host A sends segment 4 again.
11. This time it gets through the router.
   ha -> r: seg 4
12. It reaches host B.
   r -> hb: seg 4
13. Host B puts the four segments back in order: the message.
   seg 1, seg 2, seg 3, seg 4 merge into msg: message

#### Source: `fixtures/format/68-3d-a-message-through-a-router-in-segments.dh.md`

````text
---
title: "3D: a message through a router, in segments"
description: A fixture made from the Format page section of the same name.
---

## 3D: a message through a router, in segments

A thing can have an inside. `group r "router" closed=yes` draws the router's inside faint and without words; `zoom into r` flies the camera in and opens it, and `zoom out` closes it again. Inside, a queue holds tokens: `move ... into q` puts them at its back, and `pop q to p2` takes the front one out. `drop msg.4 at q` sends a token there and loses it, the way a full router drops a packet. Here, TCP cuts a message into segments, a router forwards them, one is lost and sent again, and host B puts the message back together.

```animation 3d
layer net "one network"
family a "host A"
family b "host B"
family rr "router"
group ha "host A" layout=column is=a
group r "router" closed=yes layout=free is=rr
queue q "input queue" in r pos=0,0 is=rr
table rt "routing table" in r pos=0,2.2 is=rr: to, port
row r1 in rt: host B, 2
row r2 in rt: host C, 1
group p2 "port 2" in r layout=column pos=4.4,2.2 is=rr
group hb "host B" layout=column is=b
ha -> q
p2 -> hb
token msg "message" in ha is=a
@step Host A has one message for host B: too big for one packet.
highlight msg
@step TCP cuts it into four numbered segments.
split msg into 4 "seg"
@step Zoom into the router: an input queue, a routing table, and port 2.
zoom into r
@step The segments arrive. The queue holds three; segment 4 finds it full.
move msg.1 msg.2 msg.3 into q
drop msg.4 at q
@step The routing table says host B is behind port 2.
highlight r1
@step The oldest segment leaves the queue for port 2.
pop q to p2
@step The next one follows; segment 3 waits its turn.
pop q to p2
@step Zoom out: segments 1 and 2 cross the wire to host B.
zoom out
move msg.1 msg.2 into hb
@step Segment 3 follows them.
pop q to hb
@step Host B has 1, 2 and 3, but not 4. Host A sends segment 4 again.
add token msg.4 "seg 4" in ha
@step This time it gets through the router.
move msg.4 to r
@step It reaches host B.
move msg.4 into hb
@step Host B puts the four segments back in order: the message.
merge msg
```
````

## 3D: the seven network layers, and a scene inside the scene

A scene can hold a scene of its own. `scene tcp "Transport, up close"` in the setup, its own lines, then `end`, declares it, with its own things and layout. `enter tcp from a4` flies the camera into `a4` and shows that scene instead of the overview; the steps after it change that scene; `leave` flies back out to the overview, just as it was left. The caption says which scene you are in, the slider marks its steps, and "All steps" lists them inside the step that enters. Here, a request goes down the seven layers of the OSI model on one machine and up them on the other; at layer 4 the story zooms into how TCP labels, cuts and rebuilds the message. It reads the same in 2D: press **2D**.

Animation, 18 steps, with 1 scene inside it (tcp "Transport, up close"). Two machines, each with the seven OSI layers; a request ("GET /") starts in the browser at layer 7.

1. to 4. Down layers 7, 6 (formatted, encrypted) and 5 (session) to layer 4, where TCP splits it into seg 1 to 3.
5. Enters scene tcp from a4: the sender's TCP (the 3,000 bytes, a header with ports and a sequence number), a network, the receiver's TCP.
   6. to 11. Cut into seq 1, seq 1001, seq 2001; all cross the network; 1 and 3 arrive first; 2 arrives late and goes between them; joined again; the receiver answers ACK 3001.
12. Leaves scene tcp: back to the overview, as it was, at a4.
13. to 18. Down layers 3, 2 and 1, across the wire, up to layer 4 where TCP joins the segments, and up to the web server, which reads GET /.

#### Source: `fixtures/format/69-3d-the-seven-network-layers-and-a-scene-inside-the-scene.dh.md`

````text
---
title: "3D: the seven network layers, and a scene inside the scene"
description: A fixture made from the Format page section of the same name.
---

## 3D: the seven network layers, and a scene inside the scene

A scene can hold a scene of its own. `scene tcp "Transport, up close"` in the setup, its own lines, then `end`, declares it, with its own things and layout. `enter tcp from a4` flies the camera into `a4` and shows that scene instead of the overview; the steps after it change that scene; `leave` flies back out to the overview, just as it was left. The caption says which scene you are in, the slider marks its steps, and "All steps" lists them inside the step that enters. Here, a request goes down the seven layers of the OSI model on one machine and up them on the other; at layer 4 the story zooms into how TCP labels, cuts and rebuilds the message. It reads the same in 2D: press **2D**.

```animation 3d size=s
layer l7 "7 application"
layer l6 "6 presentation"
layer l5 "5 session"
layer l4 "4 transport"
layer l3 "3 network"
layer l2 "2 data link"
layer l1 "1 physical"
family cl "the browser's machine"
family sv "the server's machine"
box a7 "browser" layer=l7 is=cl
box b7 "web server" layer=l7 is=sv
box a6 "format, encrypt" layer=l6 is=cl
box b6 "decrypt" layer=l6 is=sv
box a5 "session" layer=l5 is=cl
box b5 "session" layer=l5 is=sv
box a4 "TCP" layer=l4 is=cl
box b4 "TCP" layer=l4 is=sv
box a3 "IP" layer=l3 is=cl
box b3 "IP" layer=l3 is=sv
box a2 "Ethernet" layer=l2 is=cl
box b2 "Ethernet" layer=l2 is=sv
box a1 "signals" layer=l1 is=cl
box b1 "signals" layer=l1 is=sv
a7 -> a6 -> a5 -> a4 -> a3 -> a2 -> a1
b1 -> b2 -> b3 -> b4 -> b5 -> b6 -> b7
a1 -> b1 "the wire"
token msg "GET /" at a7 is=cl
scene tcp "Transport, up close" layout=column
  group snd "sender's TCP" layout=column is=cl
  group out "to send" in snd layout=row
  token m "3,000 bytes" in out is=cl
  table hdr "TCP header" in snd: field, value
  row h1 in hdr: from port, 51514
  row h2 in hdr: to port, 443
  row h3 in hdr: sequence, its first byte
  cloud net "the network"
  group rcv "receiver's TCP" layout=column is=sv
  group buf "receive buffer" in rcv layout=row
  snd -> net -> rcv
end
@step A browser asks a web server for a page. The request starts at layer 7, application: HTTP.
split layers
highlight a7
@step Layer 6, presentation: the request is put in an agreed format and encrypted.
move msg to a6
set msg label=encrypted
@step Layer 5, session: the conversation between the two programs stays open for the reply.
move msg to a5
@step Layer 4, transport: TCP cuts the message into three numbered segments.
move msg to a4
then
split msg into 3 "seg"
@step Up close: how TCP labels the segments, sends them, and puts them back together.
enter tcp from a4
@step Each segment gets a TCP header: the ports say which program it is from and for; the sequence number says where its bytes go.
highlight hdr
@step TCP cuts the 3,000 bytes into three segments of 1,000. Each is numbered by its first byte: 1, 1001, 2001.
split m into s1 "seq 1" s2 "seq 1001" s3 "seq 2001"
@step All three go out on the network. Each may take its own path.
move s1 s2 s3 to net
@step Segments 1 and 3 arrive first. TCP keeps 3 aside: bytes from 1001 are missing.
move s1 s3 into buf
@step Segment 2 arrives late. Its sequence number says where it goes: between 1 and 3.
move s2 into buf after s1
@step In order again, the segments are joined back into the 3,000 bytes. TCP sends back ACK 3001: "next, I expect byte 3001".
merge s1 s2 s3 into m2 "3,000 bytes"
send arrow "ACK 3001" rcv -> net
@step Back at the overview, where we left it. Now follow the segments down, across and up.
leave
@step Layer 3, network: each segment gets an IP header with both machines' addresses. It is now a packet.
move msg.1 msg.2 msg.3 to a3
@step Layer 2, data link: each packet goes in a frame for the next hop on the local network.
move msg.1 msg.2 msg.3 to a2
@step Layer 1, physical: the frames become signals.
move msg.1 msg.2 msg.3 to a1
@step The signals cross the wire to the server's machine.
move msg.1 msg.2 msg.3 to b1
@step Going up, layers 1 to 3 each read and remove their twin's header. TCP joins the segments, as we saw up close.
move msg.1 msg.2 msg.3 to b4
then
merge msg
@step Up through session and presentation, where it is decrypted, the web server reads the request.
move msg to b7
set msg label="GET /"
highlight b7 tone=good
```

:::llm
Animation, 18 steps, with 1 scene inside it (tcp "Transport, up close"). Two machines, each with the seven OSI layers; a request ("GET /") starts in the browser at layer 7.

1. to 4. Down layers 7, 6 (formatted, encrypted) and 5 (session) to layer 4, where TCP splits it into seg 1 to 3.
5. Enters scene tcp from a4: the sender's TCP (the 3,000 bytes, a header with ports and a sequence number), a network, the receiver's TCP.
   6. to 11. Cut into seq 1, seq 1001, seq 2001; all cross the network; 1 and 3 arrive first; 2 arrives late and goes between them; joined again; the receiver answers ACK 3001.
12. Leaves scene tcp: back to the overview, as it was, at a4.
13. to 18. Down layers 3, 2 and 1, across the wire, up to layer 4 where TCP joins the segments, and up to the web server, which reads GET /.
:::
````

## 3D: a database in three regions

Regions as layers: a write lands in one region, and its copies arrive in the others at different times.

Animation, 7 steps. Starts with: person u1 "user in Virginia"; cylinder db1 "primary"; person u2 "user in Paris"; cylinder db2 "replica"; person u3 "user in Mumbai"; cylinder db3 "replica". Connected: db1 --> db2 "copies", db1 --> db3 "copies". Layers, top to bottom: us "us-east" (u1, db1); eu "eu-west" (u2, db2); ap "ap-south" (u3, db3). Families, one colour each: user "users" (u1, u2, u3); db "database" (db1, db2, db3); copy "copying" (db1 -> db2, db1 -> db3).

1. Three regions, each with a copy of the database. Only the primary, in us-east, takes writes.
2. A user in Virginia adds an item to their cart. The primary writes it as change 41.
   u1 -> db1: write: cart +1
3. The primary sends change 41 down to the other regions.
   db1 -> db2: change 41
   db1 -> db3: change 41
4. Paris gets it first.
5. Mumbai is further away and still has change 40.
6. Look at ap-south alone: a read here now gets the cart without the new item. That gap is replication lag.
   u3 -> db3: read cart
7. A moment later change 41 arrives, and every region reads the same cart.
   u3 -> db3: read cart

#### Source: `fixtures/format/70-3d-a-database-in-three-regions.dh.md`

````text
---
title: "3D: a database in three regions"
description: A fixture made from the Format page section of the same name.
---

## 3D: a database in three regions

Regions as layers: a write lands in one region, and its copies arrive in the others at different times.

```animation 3d
layer us "us-east"
layer eu "eu-west"
layer ap "ap-south"
family user "users"
family db "database"
family copy "copying"
person u1 "user in Virginia" layer=us is=user
cylinder db1 "primary" layer=us is=db note="takes every write"
person u2 "user in Paris" layer=eu is=user
cylinder db2 "replica" layer=eu is=db note="a read-only copy"
person u3 "user in Mumbai" layer=ap is=user
cylinder db3 "replica" layer=ap is=db note="a read-only copy"
db1 --> db2 "copies" is=copy
db1 --> db3 "copies" is=copy
@step Three regions, each with a copy of the database. Only the primary, in us-east, takes writes.
split layers
@step A user in Virginia adds an item to their cart. The primary writes it as change 41.
send "write: cart +1" u1 -> db1
say db1: change 41
@step The primary sends change 41 down to the other regions.
send arrow "change 41" db1 -> db2 is=copy
send arrow "change 41" db1 -> db3 is=copy
@step Paris gets it first.
highlight db2 tone=good
camera db2 db3 turn=right tilt=low
@step Mumbai is further away and still has change 40.
highlight db3 tone=warn
say db3: still at 40
@step Look at ap-south alone: a read here now gets the cart without the new item. That gap is replication lag.
focus ap
send "read cart" u3 -> db3
@step A moment later change 41 arrives, and every region reads the same cart.
focus all
camera all
highlight db3 tone=good
send "read cart" u3 -> db3
```
````

## 3D: not only code, a building's floors

Floors as layers, and people moving between them: `move` into a container on another layer carries a thing (and what it holds) up or down.

Animation, 5 steps. Starts with: group fl3 [group lift, box desk "Ana's desk"]; group fl2 [box cafe]; group fl1 [box gym]; group lobby [person ana "Ana", person ben "Ben"]. Layers, top to bottom: f3 "3rd floor: offices" (fl3); f2 "2nd floor: cafe" (fl2); f1 "1st floor: gym" (fl1); gr "lobby" (lobby).

1. A building with four floors. Ana and Ben wait in the lobby; the lift is up on the 3rd floor.
2. The lift comes down to the lobby.
3. Ana and Ben step in.
4. The lift goes up to the 2nd floor, and Ben gets out for coffee.
5. The lift goes on to the 3rd floor, and Ana walks to her desk.

#### Source: `fixtures/format/71-3d-not-only-code-a-building-s-floors.dh.md`

````text
---
title: "3D: not only code, a building's floors"
description: A fixture made from the Format page section of the same name.
---

## 3D: not only code, a building's floors

Floors as layers, and people moving between them: `move` into a container on another layer carries a thing (and what it holds) up or down.

```animation 3d
layer f3 "3rd floor: offices"
layer f2 "2nd floor: cafe"
layer f1 "1st floor: gym"
layer gr "lobby"
group fl3 layer=f3
group fl2 layer=f2
group fl1 layer=f1
group lobby layer=gr
group lift "lift" in fl3 tone=acc
box desk "Ana's desk" in fl3
box cafe "cafe" in fl2
box gym "gym" in fl1
person ana "Ana" in lobby
person ben "Ben" in lobby
@step A building with four floors. Ana and Ben wait in the lobby; the lift is up on the 3rd floor.
split layers
@step The lift comes down to the lobby.
move lift to lobby
@step Ana and Ben step in.
move ana to lift
move ben to lift
@step The lift goes up to the 2nd floor, and Ben gets out for coffee.
move lift to fl2
then
move ben to fl2
@step The lift goes on to the 3rd floor, and Ana walks to her desk.
move lift to fl3
then
move ana to fl3 after desk
focus f3
```
````

## 3D: a 2D scene, unchanged

The pass-4 scene of pods, nodes and a service, with the same source. Press **3D** on its stage: with no layers declared, each nesting level is a layer, so the cluster, the nodes and the pods stand at three heights.

Animation, 5 steps. Starts with: group cluster [group n1 "node 1" [pill w1 "web-1", pill c1 "cache-1"], group n2 "node 2" [pill w2 "web-2"], group n3 "node 3" [pill w3 "web-3"]]; pill svc "service: web". Connected: svc -> w1, svc -> w2, svc -> w3.

1. Pods run on nodes; nodes make up the cluster. The service is one name in front of the three web pods.
2. Calls to the service are spread over its pods: rules on every node pick one.
   svc -> w1: GET /
   svc -> w2: GET /cart
3. Node 2 dies, and web-2 with it.
4. The scheduler starts a new web-2 on node 3, which has room.
5. The rules now pick among the running pods only; nobody sees a gap.
   svc -> w2b: GET /cart

#### Source: `fixtures/format/72-3d-a-2d-scene-unchanged.dh.md`

````text
---
title: "3D: a 2D scene, unchanged"
description: A fixture made from the Format page section of the same name.
---

## 3D: a 2D scene, unchanged

The pass-4 scene of pods, nodes and a service, with the same source. Press **3D** on its stage: with no layers declared, each nesting level is a layer, so the cluster, the nodes and the pods stand at three heights.

```animation dir=down
group cluster "cluster" layout=row
group n1 "node 1" in cluster
group n2 "node 2" in cluster
group n3 "node 3" in cluster
pill w1 "web-1" in n1
pill c1 "cache-1" in n1
pill w2 "web-2" in n2
pill w3 "web-3" in n3
pill svc "service: web"
svc -> w1
svc -> w2
svc -> w3
note svc: one stable name and address in front of the web pods
@step Pods run on nodes; nodes make up the cluster. The service is one name in front of the three web pods.
camera all
@step Calls to the service are spread over its pods: rules on every node pick one.
send "GET /" svc -> w1
send "GET /cart" svc -> w2
@step Node 2 dies, and web-2 with it.
set n2 down=yes
set w2 down=yes
camera cluster
@step The scheduler starts a new web-2 on node 3, which has room.
remove w2
add pill w2b "web-2" in n3 tone=good
svc -> w2b
@step The rules now pick among the running pods only; nobody sees a gap.
send "GET /cart" svc -> w2b
camera all
```
````

## 3D by a new author: a memory read

Written from the spec alone by a helper that had not seen the engine; doccheck passed it on the first try.

Animation, 8 steps. Starts with: box cpu "program"; box c1 "L1 cache"; box c2 "L2 cache"; box mem "RAM"; cylinder dsk "disk"; pill vx "x = 42". Connected: cpu -> c1, c1 -> c2, c2 -> mem, mem -> dsk. Layers, top to bottom: reg "registers" (cpu); l1 "L1 cache" (c1); l2 "L2 cache" (c2); ram "RAM" (mem, vx); disk (dsk).

1. The program wants the value x. It asks the fastest place first, the L1 cache, and x is not there (a miss).
   cpu -> c1: read x
2. The L1 cache passes the question down to the L2 cache. Another miss.
   c1 -> c2: read x
3. The L2 cache asks RAM, and RAM has x (a hit). The disk is not needed.
   c2 -> mem: read x
4. Zoom in on RAM. This is the slow part of the trip, which is why caches exist.
5. The camera pulls back. The value starts its way up, and the L2 cache keeps a copy.
   mem -> c2: x = 42
6. The L1 cache keeps a copy too.
   c2 -> c1: x = 42
7. The value reaches the program and is held in a register.
   c1 -> cpu: x = 42
8. Layers back together. The next read of x is answered at once, with no trip down.

#### Source: `fixtures/format/73-3d-by-a-new-author-a-memory-read.dh.md`

````text
---
title: "3D by a new author: a memory read"
description: A fixture made from the Format page section of the same name.
---

## 3D by a new author: a memory read

Written from the spec alone by a helper that had not seen the engine; doccheck passed it on the first try.

```animation 3d dir=down
layer reg "registers" note="Inside the CPU. Tiny and the fastest place there is."
layer l1 "L1 cache" note="Small and very fast. Each core has its own."
layer l2 "L2 cache" note="Bigger than L1 and a bit slower."
layer ram "RAM" note="Main memory. Large, but far slower than the caches."
layer disk "disk" note="Storage. Huge, and by far the slowest."
box cpu "program" layer=reg
box c1 "L1 cache" layer=l1
box c2 "L2 cache" layer=l2
box mem "RAM" layer=ram note="Holds the data the program is using right now."
cylinder dsk "disk" layer=disk
pill vx "x = 42" layer=ram
cpu -> c1 -> c2 -> mem -> dsk
@step The program wants the value x. It asks the fastest place first, the L1 cache, and x is not there (a miss).
split layers
send "read x" cpu -> c1
say c1: miss, no x here
@step The L1 cache passes the question down to the L2 cache. Another miss.
send "read x" c1 -> c2
say c2: miss, no x here
highlight c2 tone=warn
@step The L2 cache asks RAM, and RAM has x (a hit). The disk is not needed.
send "read x" c2 -> mem
say mem: found x
highlight mem vx tone=good
set dsk dim=yes
@step Zoom in on RAM. This is the slow part of the trip, which is why caches exist.
focus ram
note vx: the value the program asked for
@step The camera pulls back. The value starts its way up, and the L2 cache keeps a copy.
focus all
send "x = 42" mem -> c2
add pill x2 "x = 42" layer=l2
@step The L1 cache keeps a copy too.
send "x = 42" c2 -> c1
add pill x1 "x = 42" layer=l1
@step The value reaches the program and is held in a register.
send "x = 42" c1 -> cpu
add pill xr "x = 42" layer=reg
@step Layers back together. The next read of x is answered at once, with no trip down.
stack layers
highlight xr tone=good
```
````

## Animation: code, bold and italic in captions

Captions, `say` and `note=` take three marks: `code`, **bold** and *italic*. Words on the stage stay plain.

Animation, 3 steps. Starts with: person dev "you"; box repo; box ci "CI".

1. You run `task gen`; it is **never** done by *hand*.
2. CI checks that the **generated** files match.
3. Click the repo to read its note: it uses `code` and **bold** too.

#### Source: `fixtures/format/93-animation-inline-marks.dh.md`

````text
---
title: "Animation: code, bold and italic in captions"
description: Captions, speech and notes take three marks (SPEC 6.15); words on the stage stay plain.
---

## Animation: code, bold and italic in captions

Captions, `say` and `note=` take three marks: `code`, **bold** and *italic*. Words on the stage stay plain.

```animation layout=graph
person dev "you"
box repo "repo" note="Holds the `contract.yaml` and the **generated** files."
box ci "CI"
@step You run `task gen`; it is **never** done by *hand*.
dev -> repo "task gen"
say dev: I ran `task gen` first
@step CI checks that the **generated** files match.
repo -> ci "push"
@step Click the repo to read its note: it uses `code` and **bold** too.
highlight repo
```
````

## Animation: long paths in labels

A path breaks only after a `/`, on a laptop and on a phone, and always keeps the name of its file.

Animation, 2 steps. Starts with: box src "features/checkout/observability/contract.yaml"; box out "internal/wiring/registry/providers.go"; box dash "observability/dashboards/checkout-overview.json". Connected: src -> out "task gen", src -> dash.

1. The contract is the one source.
2. One run generates both files from it.

#### Source: `fixtures/format/94-animation-long-paths-in-labels.dh.md`

````text
---
title: "Animation: long paths in labels"
description: A path breaks only after a slash, on a laptop and on a phone, and always keeps the name of its file (SPEC 6.15).
---

## Animation: long paths in labels

A path breaks only after a `/`, on a laptop and on a phone, and always keeps the name of its file.

```animation layout=graph dir=down
box src "features/checkout/observability/contract.yaml"
box out "internal/wiring/registry/providers.go"
box dash "observability/dashboards/checkout-overview.json"
src -> out "task gen"
src -> dash
@step The contract is the one source.
highlight src
@step One run generates both files from it.
highlight out dash
```
````

## Animation: a sent token becomes an item

`send ... as <id>` into a queue, a stack or a list leaves the token there as an item, so a later line can take it out.

Animation, 2 steps. Starts with: box app; queue buf "send buffer": empty; box net "network". Connected: app -> buf, buf -> net.

1. The app sends a segment into the buffer.
   app -> buf: seg 1
2. The network reads the oldest segment.
   buf -> net: seg 1

#### Source: `fixtures/format/95-animation-sent-items.dh.md`

````text
---
title: "Animation: a sent token becomes an item"
description: A token sent into a queue joins it as an item that pop and move work on (SPEC 6.15).
---

## Animation: a sent token becomes an item

`send ... as <id>` into a queue, a stack or a list leaves the token there as an item, so a later line can take it out.

```animation layout=graph
box app "app"
queue buf "send buffer"
box net "network"
app -> buf
buf -> net
@step The app sends a segment into the buffer.
send "seg 1" app -> buf as s1
@step The network reads the oldest segment.
pop buf to net
```
````

# The composed stage

## Animation: a composed stage

An animation is **composed** by default: lanes left to right, cards with lines and badges, bands under lanes, then steps that show, light, tag and connect. The stage is laid out once for every step, so nothing moves; connectors are drawn after layout, from fanned ports, with their labels in the gap between lanes. Colours come from the page's `roles:` in the front matter, one per role on the whole page. A phone stacks the lanes. `layout=graph` on the fence sends a scene to the graph engine below instead.

Orders (one request, end to end)
Browsers: laptop (sends GET /orders); phone (sends GET /orders); tablet (sends GET /orders); kiosk (sends GET /orders); about 2,000 sessions.
Servers: api 0 (answers in JSON) [a: worker a; b: worker b]; api 1 (answers in JSON) [a: worker a; b: worker b].
Storage: orders database (primary; region east).
Also (under Servers to Storage): config service (pushes routes and limits).
1. Ask: Each browser asks one server.
   GET: laptop to api 0, tablet to api 0, phone to api 1, kiosk to api 1 (dashed).
   laptop, tablet: to api 0.
   phone, kiosk: to api 1.
2. Read: The servers read from the database.
   SELECT: api 0 to orders database, api 1 to orders database (dashed).
   orders database says: one primary.
3. Config: The config service is off the data path.
   polled: config service to api 1, config service to orders database.
4. In short: Browsers pull from servers; servers read one database.
   Key (client): GET  browser to server.
   Key (store): SELECT  server to database.

#### Source: `fixtures/stage/01-animation-a-composed-stage.dh.md`

````text
---
title: "Animation: a composed stage"
description: A fixture made from the Format page section of the same name (a composed stage).
roles:
  client: c1
  server: c2
  store: c3
  job: c4
  cache: c5
  ops: c6
  plain: c0
---

## Animation: a composed stage

An animation is **composed** by default: lanes left to right, cards with lines and badges, bands under lanes, then steps that show, light, tag and connect. The stage is laid out once for every step, so nothing moves; connectors are drawn after layout, from fanned ports, with their labels in the gap between lanes. Colours come from the page's `roles:` in the front matter, one per role on the whole page. A phone stacks the lanes. `layout=graph` on the fence sends a scene to the graph engine below instead.

```animation
title: Orders | one request, end to end
## Browsers
client b1..b4: laptop; phone; tablet; kiosk | sends GET /orders
... about 2,000 sessions
## Servers
server s0,s1: api 0; api 1 | answers in JSON
  + (a) worker a; (b) worker b
## Storage
store db: orders database | primary | region east
## _ under Servers..Storage
ops cfg: config service | pushes routes and limits
@step Ask: Each browser asks one server.
b1,b3 --> s0: GET
b2,b4 --> s1: GET
tag b1,b3: to api 0
tag b2,b4: to api 1
light s0,s1
@step Read: The servers read from the database.
s0,s1 --> db (store): SELECT
say db: one primary
light db
@step Config: The config service is off the data path.
cfg -> s1, db: polled
light cfg
@step In short: Browsers pull from servers; servers read one database.
key client: GET  browser to server
key store: SELECT  server to database
```
````

## Animation: a phase strip and swapped panels

A `track:` is a strip of phases, coloured by role; `at` puts each step on it, and `carry:` follows the step. A panel (`grid`, `rows`, `map`, `list`) shows only in its step, in one region as tall as the tallest, so the page does not jump. A grid item ends with a verdict, `[+ kept]` or `[- why]`.

Phases: fetch, resolve, lookup, build, test, publish. Where: a monorepo of 40 packages · the main branch.
1. Resolve: Every package is listed; drafts and private ones are dropped.
   At: resolve (carrying one package).
   ui-kit (3.2.0 · ready): kept.
   router (1.9.4 · ready): kept.
   icons (0.8.0 · draft): dropped, draft: skip.
   internal-tools (0.1.0 · private): dropped, private: skip.
   only ready, public packages go on
2. Cache: Each package's hash picks its cache shard.
   At: lookup (carrying one package).
   ui-kit, 3.2.0 | hash = 0x51a2, shard 2 of 8 | cache shard 2 | a hit, built before
   router, 1.9.4 | hash = 0x9f07, shard 7 of 8 | cache shard 7 | a miss, build it
   a miss sends the package on to build
3. Publish: The built package is renamed for the registry.
   At: publish (carrying one package).
   router 1.9.4 (built from the main branch), rename: kept name, version, licence; dropped source maps, test files.

#### Source: `fixtures/stage/02-animation-a-phase-strip-and-swapped-panels.dh.md`

````text
---
title: "Animation: a phase strip and swapped panels"
description: A fixture made from the Format page section of the same name (a composed stage).
roles:
  client: c1
  server: c2
  store: c3
  job: c4
  cache: c5
  ops: c6
  plain: c0
---

## Animation: a phase strip and swapped panels

A `track:` is a strip of phases, coloured by role; `at` puts each step on it, and `carry:` follows the step. A panel (`grid`, `rows`, `map`, `list`) shows only in its step, in one region as tall as the tallest, so the page does not jump. A grid item ends with a verdict, `[+ kept]` or `[- why]`.

```animation
track: job fetch, resolve | cache lookup | job build, test | store publish
carry: one package
where: a monorepo of 40 packages · the main branch
@step Resolve: Every package is listed; drafts and private ones are dropped.
at resolve
grid 2
  job: ui-kit | 3.2.0 · ready [+ kept]
  job: router | 1.9.4 · ready [+ kept]
  job: icons | 0.8.0 · draft [- draft: skip]
  job: internal-tools | 0.1.0 · private [- private: skip]
foot: only ready, public packages go on
@step Cache: Each package's hash picks its cache shard.
at lookup
rows
  ui-kit ; 3.2.0 | hash = 0x51a2 ; * shard 2 of 8 | => cache: cache shard 2 | a hit ; built before
  router ; 1.9.4 | hash = 0x9f07 ; * shard 7 of 8 | => cache: cache shard 7 | ! a miss ; build it
  ! a miss sends the package on to build
@step Publish: The built package is renamed for the registry.
at publish
map rename
  job: router 1.9.4
  built from the main branch
  to
  + name; + version; + licence; - source maps; - test files
```
````

## Animation: a worksheet

A `sheet:` lines up values in cells per row, rows in groups, and one outcome column. Steps `mark` a cell, give each row a `value`, `sum` a group (its result goes to the outcome column next) and write the `total`; `note:` and `= ...` are bands under the stage.

Takings (per hour, two shops)
two shops, each with its own tills (3 tills):
shop north (2 tills):
  till 1: 40, 55, 70, 85, 20, 35, 50
  till 2: 10, 20, 30, 40, 50, 60, 70
shop south (1 till):
  till 3: 100, 130, 160, 190, 220, 250, 280
head office (adds the shops).
1. Counts: Each till's running count, read every 10 minutes.
2. Emptied: A drop means the till was emptied; the count before it is added back.
   till 1, value 5 (20): bad, +85.
   till 1 was emptied: 85 then 20 goes down: the till was emptied so 85 is added back
3. Per hour: Each till's increase over the hour.
   per hour: till 1 95, till 2 60, till 3 180.
4. Shops: Each shop adds its own tills.
   shop north: 95 + 60 = 155, sends 155.
   shop south: 180, sends 180.
5. Office: The office adds the shops.
   head office: 155 + 180 = 335; takings per hour; 335.
   an emptied till loses nothing

#### Source: `fixtures/stage/03-animation-a-worksheet.dh.md`

````text
---
title: "Animation: a worksheet"
description: A fixture made from the Format page section of the same name (a composed stage).
roles:
  client: c1
  server: c2
  store: c3
  job: c4
  cache: c5
  ops: c6
  plain: c0
---

## Animation: a worksheet

A `sheet:` lines up values in cells per row, rows in groups, and one outcome column. Steps `mark` a cell, give each row a `value`, `sum` a group (its result goes to the outcome column next) and write the `total`; `note:` and `= ...` are bands under the stage.

```animation
title: Takings | per hour, two shops
sheet: two shops, each with its own tills | 3 tills
server s0: shop north | 2 tills
  plain t1 "till 1": 40 55 70 85 20 35 50
  plain t2 "till 2": 10 20 30 40 50 60 70
server s1: shop south | 1 till
  plain t3 "till 3": 100 130 160 190 220 250 280
=> store out: head office | adds the shops
@step Counts: Each till's running count, read every 10 minutes.
@step Emptied: A drop means the till was emptied; the count before it is added back.
mark t1 5: bad +85
note: till 1 was emptied | 85 then 20 goes down: the till was emptied | so 85 is added back
@step Per hour: Each till's increase over the hour.
value t1 t2 t3: per hour | 95, 60, 180
@step Shops: Each shop adds its own tills.
sum s0: shop north | 95 + 60 = 155 -> 155
sum s1: shop south | 180 -> 180
@step Office: The office adds the shops.
total out: 155 + 180 = 335 => takings per hour | 335
aside out: an emptied till loses nothing
```
````

## Animation: a swimlane matrix

A `matrix:` crosses **lanes** (rows) with **columns** (`column id: Title`) into cells; each cell holds cards, chips and an "and more" line. `light lane.column: words` lights a cell with a few words under its contents; `show t4` brings a card in and `light t3` puts one in focus. Every cell and card has its place from the first step, so nothing moves. A phone stacks the matrix by lane: each lane is a block, with its columns as small headings.

A photo upload (who does what, stage by stage)
Who holds the photo (five parts, four stages). Columns: Submit (the request), Queue (waits for a worker), Run (the work), Report (the answer).
Browser (the person): Submit: Upload (4 MB, one file).
API (checks and accepts): Submit: Accept (size and type checked). Report: Status (answers polling).
Worker (does the slow part): Run: Resize (three sizes); chip strip metadata.
Job queue (keeps the order): Queue: Waiting job (first in, first out); and more: about 30 more.
Storage (keeps the files): empty.
1. Send: The browser sends the file.
   Lit: Browser, Submit (the request leaves).
   In focus: Upload (4 MB, one file) [Browser, Submit].
2. Accept: The API checks it and queues a job.
   Now in the matrix: chip 202 [API, Submit].
   Lit: API, Submit (202 sent back).
   Lit: Job queue, Queue (one more waiting).
3. Work: A worker takes the job and writes the sizes.
   Lit: Worker, Run.
   Now in the matrix: chip original [Storage, Run]; chip 3 sizes [Storage, Run].
   Lit: Storage, Run (files written).
4. Done: The browser polls and shows the result.
   Now in the matrix: Done page (thumbnail shown) [Browser, Report].
   Lit: Browser, Report; API, Report.

#### Source: `fixtures/stage/04-animation-a-swimlane-matrix.dh.md`

````text
---
title: "Animation: a swimlane matrix"
description: A fixture made from the Format page section of the same name (a composed stage).
roles:
  client: c1
  server: c2
  store: c3
  job: c4
  cache: c5
  ops: c6
  plain: c0
---

## Animation: a swimlane matrix

A `matrix:` crosses **lanes** (rows) with **columns** (`column id: Title`) into cells; each cell holds cards, chips and an "and more" line. `light lane.column: words` lights a cell with a few words under its contents; `show t4` brings a card in and `light t3` puts one in focus. Every cell and card has its place from the first step, so nothing moves. A phone stacks the matrix by lane: each lane is a block, with its columns as small headings.

```animation
title: A photo upload | who does what, stage by stage
matrix: Who holds the photo | five parts, four stages
column sb: Submit | the request
column qu: Queue | waits for a worker
column rn: Run | the work
column rp: Report | the answer
client c: Browser | the person
  sb: [u1] Upload | 4 MB, one file
  rp: [u3] Done page | thumbnail shown
server a: API | checks and accepts
  sb: [a1] Accept | size and type checked; + [r202] 202
  rp: [a2] Status | answers polling
job w: Worker | does the slow part
  rn: [w1] Resize | three sizes; + strip metadata
cache k: Job queue | keeps the order
  qu: [q1] Waiting job | first in, first out; ... about 30 more
store s: Storage | keeps the files
  rn: + [orig] original; + [sizes] 3 sizes
@step Send: The browser sends the file.
light c.sb: the request leaves
light u1
@step Accept: The API checks it and queues a job.
show r202
light a.sb: 202 sent back
light k.qu: one more waiting
@step Work: A worker takes the job and writes the sizes.
light w.rn
show orig, sizes
light s.rn: files written
@step Done: The browser polls and shows the result.
show u3
light c.rp, a.rp
```
````

## Animation: time

A `time:` block is a real axis: a tick ruler, rows of states, and per step a marker (`at`) or a bracket over a span (`span`). Every mark sits at its true place.

A pipeline (build, then test, then deploy)
Time from 0 to 60 seconds:
  build: queued 0 to 4, running 4 to 31, done 31 to 60
  test: queued 0 to 31, running 31 to 52, done 52 to 60
  deploy: waiting 0 to 52, rolling 52 to 60
1. Build: The build runs first, for 27 seconds.
   build, 4 to 31: 27 s.
2. Test: The test starts when the build ends.
   At 31 seconds: build done.
3. Deploy: The deploy starts at 52 seconds.
   At 52 seconds: tests pass.

#### Source: `fixtures/stage/05-animation-time.dh.md`

````text
---
title: "Animation: time"
description: A fixture made from the Format page section of the same name (a composed stage).
roles:
  client: c1
  server: c2
  store: c3
  job: c4
  cache: c5
  ops: c6
  plain: c0
---

## Animation: time

A `time:` block is a real axis: a tick ruler, rows of states, and per step a marker (`at`) or a bracket over a span (`span`). Every mark sits at its true place.

```animation
title: A pipeline | build, then test, then deploy
time: 0..60 | seconds
row job j1 "build": queued 0..4; +running 4..31; done 31..60
row job j2 "test": queued 0..31; +running 31..52; done 52..60
row server d1 "deploy": waiting 0..52; +rolling 52..60
@step Build: The build runs first, for 27 seconds.
span j1 4..31: 27 s
@step Test: The test starts when the build ends.
at 31: build done
@step Deploy: The deploy starts at 52 seconds.
at 52: tests pass
```
````

## Animation: time up close

The full ruler and an enlarged inset share the same data. The handoff marker stays at 30 seconds, and progress uses a continuous value axis. A narrow page stacks the inset below the overview.

A studio export (prepare, render, deliver)
Time from 0 to 60 seconds:
  export: prepare 0 to 24, render 24 to 36, delivered 36 to 60
  review: waiting 0 to 30, checking 30 to 45, accepted 45 to 60
Ticks: 0, 15, 30, 45, 60.
Zoom 24 to 36: Close-up.
Values from 0 to 100 percent complete.
Start: 0 at 0.
Prepared: 25 at 24.
Halfway: 50 at 30.
Rendered: 75 at 36.
Complete: 100 at 60.
Marker 30: 30 s, review starts.
1. Prepare: Preparation takes the first 24 seconds.
   export, 0 to 24: preparation.
2. Handoff: Review begins halfway through rendering.
   At 30 seconds: halfway.
   export, 24 to 36: rendering.
3. Deliver: The export finishes before review ends.
   At 36 seconds: export complete.

#### Source: `fixtures/stage/06-animation-time-up-close.dh.md`

````text
---
title: "Animation: time up close"
description: A fixture made from the Format page section of the same name (a composed stage).
roles:
  client: c1
  server: c2
  store: c3
  job: c4
  cache: c5
  ops: c6
  plain: c0
---

## Animation: time up close

The full ruler and an enlarged inset share the same data. The handoff marker stays at 30 seconds, and progress uses a continuous value axis. A narrow page stacks the inset below the overview.

```animation
title: A studio export | prepare, render, deliver
time: 0..60 | seconds
ticks: 0, 15, 30, 45, 60
row job export "export": +prepare 0..24; +render 24..36; delivered 36..60
row server review "review": waiting 0..30; +checking 30..45; accepted 45..60
at 30: 30 s, review starts
zoom: 24..36 | Close-up
plot: 0..100 | percent complete
point job start at 0: 0 | Start
point job prepared at 24: 25 | Prepared
point job halfway at 30: 50 | Halfway
point job rendered at 36: 75 | Rendered
point job finish at 60: 100 | Complete
@step Prepare: Preparation takes the first 24 seconds.
span export 0..24: preparation
@step Handoff: Review begins halfway through rendering.
at 30: halfway
span export 24..36: rendering
@step Deliver: The export finishes before review ends.
at 36: export complete
```
````

## Animation: counted units

Each square is one unit. The grid includes the unassigned remainder, so the total can be counted directly.

A sample library (one square per clip)
64 units: kept 16, added 8, removed 4, remaining 36.

#### Source: `fixtures/stage/07-animation-counted-units.dh.md`

````text
---
title: "Animation: counted units"
description: A fixture made from the Format page section of the same name (a composed stage).
roles:
  client: c1
  server: c2
  store: c3
  job: c4
  cache: c5
  ops: c6
  plain: c0
---

## Animation: counted units

Each square is one unit. The grid includes the unassigned remainder, so the total can be counted directly.

```animation
title: A sample library | one square per clip
units 64: kept 16, added 8, removed 4
```
````

## Animation: time detail, static

The same real axes can be printed as a selected step. The marker, inset and values keep their places.

A studio export (the handoff, held still)
Time from 0 to 60 seconds:
  export: prepare 0 to 24, render 24 to 36, delivered 36 to 60
Zoom 24 to 36: Close-up.
Values from 0 to 100 percent complete.
Start: 0 at 0.
Halfway: 50 at 30.
Complete: 100 at 60.
Marker 30: 30 s, review starts.
1. Prepare: The first 24 seconds prepare the export.
   export, 0 to 24: preparation.
2. Handoff: Review begins halfway through rendering.
   At 30 seconds: halfway.

#### Source: `fixtures/stage/08-animation-time-detail-static.dh.md`

````text
---
title: "Animation: time detail, static"
description: A fixture made from the Format page section of the same name (a composed stage).
roles:
  client: c1
  server: c2
  store: c3
  job: c4
  cache: c5
  ops: c6
  plain: c0
---

## Animation: time detail, static

The same real axes can be printed as a selected step. The marker, inset and values keep their places.

```animation static=2
title: A studio export | the handoff, held still
time: 0..60 | seconds
row job export "export": +prepare 0..24; +render 24..36; delivered 36..60
at 30: 30 s, review starts
zoom: 24..36 | Close-up
plot: 0..100 | percent complete
point job start at 0: 0 | Start
point job halfway at 30: 50 | Halfway
point job finish at 60: 100 | Complete
@step Prepare: The first 24 seconds prepare the export.
span export 0..24: preparation
@step Handoff: Review begins halfway through rendering.
at 30: halfway
```
````

## Animation: units on a ruler

Every cell is one hour. State changes, markers and spans use the same ruler.

A workshop day (one cell per hour)
Time from 0 to 12 hours:
  batch: queued 0 to 3, working 3 to 9, done 9 to 12 (steps 2 onward)
  packing: empty 0 to 6 (dashed), hold 6 to 7 (step 1 only, warning), box 6 to 7 (steps 2 onward), packing 7 to 11 (steps 2 onward, good), done 11 to 12 (steps 2 onward)
One state cell per hour.
Ticks: 0, 3, 6, 9, 12.
Marker 6: packing begins.
1. Make: The batch takes six hours to make.
   batch, 3 to 9: six hours. From this step onward.
2. Pack: Packing overlaps the last three hours of making.
   At 6 hours: both are active. From this step onward.

#### Source: `fixtures/stage/09-animation-units-on-a-ruler.dh.md`

````text
---
title: "Animation: units on a ruler"
description: A fixture made from the Format page section of the same name (a composed stage).
roles:
  client: c1
  server: c2
  store: c3
  job: c4
  cache: c5
  ops: c6
  plain: c0
---

## Animation: units on a ruler

Every cell is one hour. State changes, markers and spans use the same ruler.

```animation
title: A workshop day | one cell per hour
time: 0..12 | hours
cells: 1
ticks: 0, 3, 6, 9, 12
row job batch "batch": queued 0..3; +working 3..9; done 9..12 @2
row server pack "packing": _ 0..6 [dashed]; hold 6..7 @1 [warn]; +box 6..7 @2 [lit]; packing 7..11 @2 [good]; done 11..12 @2
at 6: packing begins
@step Make: The batch takes six hours to make.
keep span batch 3..9 [warn]: six hours
@step Pack: Packing overlaps the last three hours of making.
keep at 6 [bad]: both are active
```
````

## Animation: counted pieces beside a card

Counted rows can sit beside another step panel. The role before the parentheses colours the squares; the role inside colours the badge. Plain and muted text follow the counts.

A copy desk (counted pieces)
1. Leaving: Some pieces are leaving each desk.
   Draft (A copy remains here.).
   Stored pieces:
   job (client): 12 units, kept 8, leaving 4.
   job (server): 12 units, kept 10, leaving 2.
   One square is one piece.
   c, the client desk: 8 kept, 4 leaving.
   s, the server desk: 10 kept, 2 leaving.
   Thick borders show departing pieces.
2. Gone: The departed pieces are faint.
   Draft (The retained copy is ready.).
   Stored pieces:
   job (client): 12 units, kept 8, gone 4.
   job (server): 12 units, kept 10, gone 2.
   One square is one piece.
   c, the client desk: 8 kept, 4 gone.
   s, the server desk: 10 kept, 2 gone.
   Faint squares show departed pieces.

#### Source: `fixtures/stage/14-animation-counted-pieces-beside-a-card.dh.md`

````text
---
title: "Animation: counted pieces beside a card"
description: A fixture made from the Format page section of the same name (a composed stage).
roles:
  client: c1
  server: c2
  store: c3
  job: c4
  cache: c5
  ops: c6
  plain: c0
---

## Animation: counted pieces beside a card

Counted rows can sit beside another step panel. The role before the parentheses colours the squares; the role inside colours the badge. Plain and muted text follow the counts.

```animation
title: A copy desk | counted pieces
@step Leaving: Some pieces are leaving each desk.
card job: Draft | A copy remains here.
beside
units Stored pieces | One square is one piece.
  job (client) 12: kept 8, leaving 4
  job (server) 12: kept 10, leaving 2
  c, the client desk: 8 kept, 4 leaving.
  s, the server desk: 10 kept, 2 leaving.
  ~ Thick borders show departing pieces.
@step Gone: The departed pieces are faint.
card job: Draft | The retained copy is ready.
beside
units Stored pieces | One square is one piece.
  job (client) 12: kept 8, gone 4
  job (server) 12: kept 10, gone 2
  c, the client desk: 8 kept, 4 gone.
  s, the server desk: 10 kept, 2 gone.
  ~ Faint squares show departed pieces.
```
````

## Animation: cards inside cards

A card line indented under a card is a card **inside** it (one level). The outer card is as tall as what it holds, and a connector to or from an inner card starts or ends at the card that holds it, so no line crosses a card. A title may end in a state word, `[+ open]` (good) or `[- shut]` (bad), that a step changes with `state`; `text id: line | line` gives a card new lines from that step on; `dashed` draws a card that is not there yet, and `dashed id off` makes it solid. `## Desk across Branches..Readers` is a band whose cards run left to right in one row; a line `next row` starts the row under them, centred.

A library (books between branches)
Branches: main branch (two floors; open late), holding: ground floor (open; returns desk); top floor (shut; reading room).
Vans: book van (one driver), holding: morning run (8 stops); evening run (5 stops).
Readers: readers, holding: card holder (borrows 3); new reader (no card yet).
Desk (across Branches to Readers): check in; shelve; lend; repair.
1. Morning: Books leave the main branch on the morning van.
   40 books: ground floor to book van.
   drop-off: morning run to readers.
   new reader is dashed (not there yet).
2. Evening: The top floor opens and a new reader joins.
   new reader: joined.
   evening run says: runs late tonight and comes back by ten; one driver.
   evening run says: no stops on the hill.
   evening run now reads: 5 stops; and the late club.
   top floor: open.
   new reader is solid.
3. Desk: Every book goes through the desk, one step at a time.
   next: check in to shelve, shelve to lend (dashed).
   mended: repair to shelve.
   The earlier connectors are gone.

#### Source: `fixtures/stage/15-animation-cards-inside-cards.dh.md`

````text
---
title: "Animation: cards inside cards"
description: A fixture made from the Format page section of the same name (a composed stage).
roles:
  client: c1
  server: c2
  store: c3
  job: c4
  cache: c5
  ops: c6
  plain: c0
---

## Animation: cards inside cards

A card line indented under a card is a card **inside** it (one level). The outer card is as tall as what it holds, and a connector to or from an inner card starts or ends at the card that holds it, so no line crosses a card. A title may end in a state word, `[+ open]` (good) or `[- shut]` (bad), that a step changes with `state`; `text id: line | line` gives a card new lines from that step on; `dashed` draws a card that is not there yet, and `dashed id off` makes it solid. `## Desk across Branches..Readers` is a band whose cards run left to right in one row; a line `next row` starts the row under them, centred.

```animation
title: A library | books between branches
## Branches
store h: main branch | two floors | open late
  store f1: ground floor [+ open] | returns desk
  store f2: top floor [- shut] | reading room
## Vans
job v: book van | one driver
  job v1: morning run | 8 stops
  job v2: evening run | 5 stops
## Readers
client r: readers
  client r1: card holder | borrows 3
  client r2: new reader | no card yet
## Desk across Branches..Readers
ops a: check in
ops b: shelve
ops c: lend
next row
ops d: repair
@step Morning: Books leave the main branch on the morning van.
dashed r2
f1 -> v: 40 books
v1 -> r: drop-off
@step Evening: The top floor opens and a new reader joins.
state f2: [+ open]
text v2: 5 stops | and the late club
dashed r2 off
tag r2: joined
say v2: runs late tonight and comes back by ten | one driver
say v2: no stops on the hill
@step Desk: Every book goes through the desk, one step at a time.
clear
a --> b: next
b --> c: next
d -> b: mended
```
````

## Animation: pills that move

`pill ids: words; words` under a card stacks pills at its foot. `move p3 to w` draws the pill in the other card from that step on; both cards keep a place for it, so nothing else moves. `light p1: note` lights a pill with a note at its right end, `tone id bad` (or `good`, `warn`, `accent`, `off`) and `dim id` change a card from that step on, and `align: top` gives the cards of a row one top and one foot.

Bakery shelves (trays move as they sell)
Oven: oven (batch 1); timer (20 minutes).
Shelf A: shelf A (by the door) pills: rye · fresh; spelt · fresh; oat · cooling.
Shelf B: shelf B (at the back) pills: seed · fresh.
Window: window (on the street) pills: brioche · on show.
1. Bake: The oven fills shelf A.
   trays: oven to shelf A.
2. Sell: Rye sells out and the oat loaf moves to the window.
   shelf A now reads: rye is gone; spelt stays.
   the pill "rye · fresh" fades.
   oat · cooling moves to window.
   rye · fresh: sold.
3. Late: Shelf B runs low and closes; the timer is off.
   shelf B now reads: closed for the night.
   shelf B is in trouble.
   timer fades.

#### Source: `fixtures/stage/16-animation-pills-that-move.dh.md`

````text
---
title: "Animation: pills that move"
description: A fixture made from the Format page section of the same name (a composed stage).
roles:
  client: c1
  server: c2
  store: c3
  job: c4
  cache: c5
  ops: c6
  plain: c0
---

## Animation: pills that move

`pill ids: words; words` under a card stacks pills at its foot. `move p3 to w` draws the pill in the other card from that step on; both cards keep a place for it, so nothing else moves. `light p1: note` lights a pill with a note at its right end, `tone id bad` (or `good`, `warn`, `accent`, `off`) and `dim id` change a card from that step on, and `align: top` gives the cards of a row one top and one foot.

```animation
title: Bakery shelves | trays move as they sell
align: top
## Oven
job o: oven | batch 1
cache t: timer | 20 minutes
## Shelf A
server sa: shelf A | by the door
  pill p1,p2,p3: rye · fresh; spelt · fresh; oat · cooling
## Shelf B
server sb: shelf B | at the back
  pill p4: seed · fresh
## Window
client w: window | on the street
  pill p5: brioche · on show
@step Bake: The oven fills shelf A.
o -> sa: trays
@step Sell: Rye sells out and the oat loaf moves to the window.
move p3 to w
light p1: sold
dim p1
text sa: rye is gone | spelt stays
@step Late: Shelf B runs low and closes; the timer is off.
tone sb bad
dim t
text sb: closed for the night
```
````

## Animation: token chips and a record

`tokens: ...` under a card lays out its words as chips, in order, wrapped. `mark id word, word: tone remark` boxes some in a tone for that step only, with the remark under their row (a word with a comma is named without it, or by its place, `#3`). `keys: A; B` makes the card a record whose values read `...` until a step fills them: `fill id A, B: value; value`. The record keeps its size on every step.

Reading a recipe line (words become a plan)
Also: the line tokens: mix ( flour, sugar, salt ) then bake ( 180C, 25min ); the plan {Action: ...; Inputs: ...; Then: ...; Heat: ...; Time: ...}.
1. Read: The line is read word by word; the plan is still empty.
2. Mix: The first call names what to mix.
   the line: mix, flour, sugar, salt (accent).
   the plan: Action = mix, Inputs = flour, sugar, salt.
3. Drop: Salt is optional here, so it is dropped.
   the line: salt (bad: dropped: optional).
   the plan: Inputs = flour, sugar.
4. Bake: Then the oven, hot and for a time.
   the line: bake, 180C, 25min (accent).
   the plan: Then = bake, Heat = 180C, Time = 25 minutes.

#### Source: `fixtures/stage/17-animation-token-chips-and-a-record.dh.md`

````text
---
title: "Animation: token chips and a record"
description: A fixture made from the Format page section of the same name (a composed stage).
roles:
  client: c1
  server: c2
  store: c3
  job: c4
  cache: c5
  ops: c6
  plain: c0
---

## Animation: token chips and a record

`tokens: ...` under a card lays out its words as chips, in order, wrapped. `mark id word, word: tone remark` boxes some in a tone for that step only, with the remark under their row (a word with a comma is named without it, or by its place, `#3`). `keys: A; B` makes the card a record whose values read `...` until a step fills them: `fill id A, B: value; value`. The record keeps its size on every step.

```animation
title: Reading a recipe line | words become a plan
## _
plain q: the line
  tokens: mix ( flour, sugar, salt ) then bake ( 180C, 25min )
store r: the plan
  keys: Action; Inputs; Then; Heat; Time
@step Read: The line is read word by word; the plan is still empty.
@step Mix: The first call names what to mix.
mark q mix, flour, sugar, salt: accent
fill r Action, Inputs: mix; flour, sugar, salt
@step Drop: Salt is optional here, so it is dropped.
mark q salt: bad dropped: optional
fill r Inputs: flour, sugar
@step Bake: Then the oven, hot and for a time.
mark q bake, 180C, 25min: accent
fill r Then, Heat, Time: bake; 180C; 25 minutes
```
````

## Animation: two arrows, one label each

A connector line of one pair keeps its own label: two lines that both say `30 crates` show it on both arrows. A line of several pairs, `m -> s, t: 12 each`, shows its label once for the bundle, and so do such lines with one label across one gap.

A market morning (crates in, crates out)
Farms: hill farm (apples); river farm (pears).
Market: market hall (one floor).
Shops: corner shop; station kiosk.
1. Arrive: Both farms bring the same load.
   30 crates: hill farm to market hall, river farm to market hall.
2. Share: The hall sends some on, the same to each shop.
   12 each: market hall to corner shop, market hall to station kiosk.
3. Again: Next morning the hill farm comes again with the same load.
   30 crates: hill farm to market hall.
   The earlier connectors are gone.

#### Source: `fixtures/stage/18-animation-two-arrows-one-label-each.dh.md`

````text
---
title: "Animation: two arrows, one label each"
description: A fixture made from the Format page section of the same name (a composed stage).
roles:
  client: c1
  server: c2
  store: c3
  job: c4
  cache: c5
  ops: c6
  plain: c0
---

## Animation: two arrows, one label each

A connector line of one pair keeps its own label: two lines that both say `30 crates` show it on both arrows. A line of several pairs, `m -> s, t: 12 each`, shows its label once for the bundle, and so do such lines with one label across one gap.

```animation
title: A market morning | crates in, crates out
## Farms
job a: hill farm | apples
job b: river farm | pears
## Market
store m: market hall | one floor
## Shops
client s: corner shop
client t: station kiosk
@step Arrive: Both farms bring the same load.
a -> m: 30 crates
b -> m: 30 crates
@step Share: The hall sends some on, the same to each shop.
m -> s, t: 12 each
@step Again: Next morning the hill farm comes again with the same load.
clear
a -> m: 30 crates
```
````

## Animation: a key

With the setup line `key at: top right`, the scene's `key role: words; words` entries form a legend at the stage's top right, each a small swatch in the role's colour with its words beside it. An entry shows from the step that writes it; its place is kept from the start, so nothing moves. Without that line the key stays at the bottom left.

A bike shop (parts in, bikes out)
Store room: parts shelf (wheels, chains).
Bench: fitter (one bench).
Door: rider.
1. Parts: The fitter takes parts from the shelf.
   two wheels: parts shelf to fitter.
   Key (store): kept in stock.
   Key (job): work done here.
2. Ride: The bike goes out of the door.
   one bike: fitter to rider.
   Key (client): who it is for.

#### Source: `fixtures/stage/19-animation-a-key.dh.md`

````text
---
title: "Animation: a key"
description: A fixture made from the Format page section of the same name (a composed stage).
roles:
  client: c1
  server: c2
  store: c3
  job: c4
  cache: c5
  ops: c6
  plain: c0
---

## Animation: a key

With the setup line `key at: top right`, the scene's `key role: words; words` entries form a legend at the stage's top right, each a small swatch in the role's colour with its words beside it. An entry shows from the step that writes it; its place is kept from the start, so nothing moves. Without that line the key stays at the bottom left.

```animation
title: A bike shop | parts in, bikes out
key at: top right
## Store room
store p: parts shelf | wheels, chains
## Bench
job f: fitter | one bench
## Door
client c: rider
@step Parts: The fitter takes parts from the shelf.
p -> f: two wheels
key store: kept in stock
key job: work done here
@step Ride: The bike goes out of the door.
f -> c: one bike
key client: who it is for
```
````

## Animation: boxes inside boxes

A `nest:` draws wrappers as boxes inside boxes, outside first, each with a role, a title, a size and its fields; a field after `> ` sits at the box's end, under what it holds. Every box has its place from the first step, so a wrapper put round later, or taken off, moves nothing. A step can `show` a wrapper, `light` it or one of its fields, give it new `fields` or a new `title`, `set` one field (the old value struck beside the new one, for that step), `unwrap` it (the wrapper comes off what it holds: dashed and struck for that step, then gone) or `hide` it. Fields are written in the mono face, so they line up.

A parcel (wrapped for the trip, unwrapped at the door)
The parcel (outside in):
- shipping crate (store), 40 kg, from step 2: to the depot; from the warehouse; seal 7731
  - box (job), 2 kg: to the house; status: packed
    - gift (client), a mug: wrapped in paper
1. Boxed: The gift goes in a box addressed to the house.
   Lit: gift.
2. Crated: The box rides in a crate addressed to the depot, not to the house.
   shipping crate is put round what it holds.
   Lit: to the depot (shipping crate).
3. At the depot: The crate comes off; the box goes on the van.
   shipping crate is taken off.
   box: status: packed becomes status: out for delivery.
4. At the door: The box comes off, and the gift is there.
   box is taken off.
   Lit: gift.

The full example, one web request through a switch, a home router and two internet routers and back, is its own page: [the layers, through several routers](../layers/).

#### Source: `fixtures/stage/20-animation-boxes-inside-boxes.dh.md`

````text
---
title: "Animation: boxes inside boxes"
description: A fixture made from the Format page section of the same name (a composed stage).
roles:
  client: c1
  server: c2
  store: c3
  job: c4
  cache: c5
  ops: c6
  plain: c0
---

## Animation: boxes inside boxes

A `nest:` draws wrappers as boxes inside boxes, outside first, each with a role, a title, a size and its fields; a field after `> ` sits at the box's end, under what it holds. Every box has its place from the first step, so a wrapper put round later, or taken off, moves nothing. A step can `show` a wrapper, `light` it or one of its fields, give it new `fields` or a new `title`, `set` one field (the old value struck beside the new one, for that step), `unwrap` it (the wrapper comes off what it holds: dashed and struck for that step, then gone) or `hide` it. Fields are written in the mono face, so they line up.

```animation
title: A parcel | wrapped for the trip, unwrapped at the door
nest: The parcel | outside in
  store crate: shipping crate | 40 kg | to the depot; from the warehouse; > seal 7731
  job box: box | 2 kg | to the house; status: packed
  client gift: gift | a mug | wrapped in paper
@step Boxed: The gift goes in a box addressed to the house.
light gift
@step Crated: The box rides in a crate addressed to the depot, not to the house.
show crate
light crate: to the depot
@step At the depot: The crate comes off; the box goes on the van.
unwrap crate
set box: status: packed => status: out for delivery
@step At the door: The box comes off, and the gift is there.
unwrap box
light gift
```

The full example, one web request through a switch, a home router and two internet routers and back, is its own page: [the layers, through several routers](../layers/).
````

## Animation: counted columns

A `columns` block is a dot histogram: one column per category, one dot per counted thing, stacked from the bottom. The columns' places are kept for the widest step, so adding columns moves nothing; `new` lights columns in the step that adds them.

A lending library (one dot per book returned)
Columns: books returned each month, one dot each, in their month's column (one dot per book), up to 12 columns.
1. First half: Six months: 12 to 31 books a month.
   6 columns, 135 books in all (12 to 31 a column): Jan 24, Feb 19, Mar 31, Apr 22, May 27, Jun 12.
2. The year: The second half adds six columns; the summer months are quiet.
   12 columns, 274 books in all (9 to 35 a column): Jan 24, Feb 19, Mar 31, Apr 22, May 27, Jun 12, Jul 9, Aug 11, Sep 28, Oct 30, Nov 26, Dec 35.
   New: Jul, Aug, Sep, Oct, Nov, Dec (139 in them).
3. December: December is the busiest month of the year.
   Lit, unchanged since the step before: Dec 35.

#### Source: `fixtures/stage/21-animation-counted-columns.dh.md`

````text
---
title: "Animation: counted columns"
description: A fixture made from the Format page section of the same name (a composed stage).
roles:
  client: c1
  server: c2
  store: c3
  job: c4
  cache: c5
  ops: c6
  plain: c0
---

## Animation: counted columns

A `columns` block is a dot histogram: one column per category, one dot per counted thing, stacked from the bottom. The columns' places are kept for the widest step, so adding columns moves nothing; `new` lights columns in the step that adds them.

```animation
title: A lending library | one dot per book returned
columns 12 store: books returned each month, one dot each, in their month's column | books
  every 3
  labels: Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec
@step First half: Six months: 12 to 31 books a month.
counts 6: 24, 19, 31, 22, 27, 12
@step The year: The second half adds six columns; the summer months are quiet.
counts 12: 24, 19, 31, 22, 27, 12, 9, 11, 28, 30, 26, 35
light Jul..Dec
@step December: December is the busiest month of the year.
light Dec
```
````

## Animation: a bar chart in a scene

A `bars` block is a small bar chart on one value axis: grid values, reference lines, and per step new values, a dotted peak line, a dashed limit (bars over it light up in its step), and moves from one bar to others, drawn as dashed arrows with the moved amount stacked on the taker. Every bar top and line sits at its true value.

A café (cups sold, by day)
Bars: day of the week · bar = cups sold ÷ the weekly average (×), 7 bars, axis 0, 0.5, 1, 1.5.
Tabs: One barista (steps 1 to 3), Two baristas (step 4).
Line average at 1.
1. Busy Friday: Friday sells 1.4 times the average day.
   Tab: One barista.
   cups by day · the week of 3 March.
   Values: Mon 0.7, Tue 0.8, Wed 0.9, Thu 1, Fri 1.4, Sat 1.3, Sun 0.9.
   Peak: busiest 1.4×.
   1.4×: busiest ÷ average.
   Lit bars: Fri 1.4 (the peak).
2. A cap: No day should go over 1.2 times the average; two days do.
   cap = 1.2 × the average · 2 days are over it.
   Limit 1.2: cap 1.2×.
   Lit bars: Fri 1.4 (the peak), Sat 1.3 (over the limit).
3. Move orders: Friday and Saturday hand pre-orders to Monday and Tuesday.
   the moves: Fri → Mon (2 trays), Sat → Tue (1 tray) · the week's total does not change.
   Values: Mon 0.9, Tue 0.9, Wed 0.9, Thu 1, Fri 1.2, Sat 1.2, Sun 0.9.
   Peak: busiest 1.2×.
   1.2×: busiest ÷ average.
   Moves: Fri to Mon (2), Sat to Tue (1).
   Lit bars: Mon 0.9 (takes), Tue 0.9 (takes), Fri 1.2 (the peak; at the limit), Sat 1.2 (the peak; at the limit).
4. Two baristas: Saturday remains the busiest day; Friday is also above average.
   Tab: Two baristas.
   two baristas, a month later.
   Values: Mon 0.9, Tue 0.9, Wed 1, Thu 1, Fri 1.1, Sat 1.2, Sun 0.9.
   Lit bars: Sat 1.2 (lit: the busiest; at the limit).

#### Source: `fixtures/stage/22-animation-a-bar-chart-in-a-scene.dh.md`

````text
---
title: "Animation: a bar chart in a scene"
description: A fixture made from the Format page section of the same name (a composed stage).
roles:
  client: c1
  server: c2
  store: c3
  job: c4
  cache: c5
  ops: c6
  plain: c0
---

## Animation: a bar chart in a scene

A `bars` block is a small bar chart on one value axis: grid values, reference lines, and per step new values, a dotted peak line, a dashed limit (bars over it light up in its step), and moves from one bar to others, drawn as dashed arrows with the moved amount stacked on the taker. Every bar top and line sits at its true value.

```animation
title: A café | cups sold, by day
bars 7 server: day of the week · bar = cups sold ÷ the weekly average | ×
  axis 0, 0.5, 1, 1.5
  line average: 1
  labels: Mon, Tue, Wed, Thu, Fri, Sat, Sun
  tabs One barista: 1..3; Two baristas: 4
@step Busy Friday: Friday sells 1.4 times the average day.
values: 0.7 0.8 0.9 1.0 1.4 1.3 0.9
peak: busiest 1.4×
heading: cups by day | the week of 3 March
big: 1.4× | busiest ÷ average
@step A cap: No day should go over 1.2 times the average; two days do.
limit 1.2: cap 1.2×
heading: cap = 1.2 × the average · 2 days are over it
@step Move orders: Friday and Saturday hand pre-orders to Monday and Tuesday.
values: 0.9 0.9 0.9 1.0 1.2 1.2 0.9
move 2 from Fri to Mon; 1 from Sat to Tue
peak: busiest 1.2×
big: 1.2× | busiest ÷ average
heading: the moves: Fri → Mon (2 trays), Sat → Tue (1 tray) | the week's total does not change
@step Two baristas: Saturday remains the busiest day; Friday is also above average.
values: 0.9 0.9 1.0 1.0 1.1 1.2 0.9
light Sat: the busiest
heading: two baristas, a month later
```
````

## Animation: a package journey

A standalone phase strip connects every adjacent phase, including links that wrap to another row on a phone.

A package journey (fetch through publish)
Phases: fetch, resolve, lookup, build, test, publish.
1. Resolve: The package starts with its dependencies.
   At: resolve (carrying one package).
2. Cache: The cache answers.
   At: lookup (carrying one package).
3. Publish: The package reaches the registry.
   At: publish (carrying one package).

#### Source: `fixtures/stage/24-animation-a-package-journey.dh.md`

````text
---
title: "Animation: a package journey"
description: A fixture made from the Format page section of the same name (a composed stage).
roles:
  client: c1
  server: c2
  store: c3
  job: c4
  cache: c5
  ops: c6
  plain: c0
---

## Animation: a package journey

A standalone phase strip connects every adjacent phase, including links that wrap to another row on a phone.

```animation
title: A package journey | fetch through publish
track: job fetch, resolve | cache lookup | job build, test | store publish
carry: one package
@step Resolve: The package starts with its dependencies.
at resolve
@step Cache: The cache answers.
at lookup
@step Publish: The package reaches the registry.
at publish
```
````

## Animation: bins

A `bins:` block sorts an inventory into named bins. `items p1..p8: words` names the things (one label for all, or one per id split by `;`); `items 40: word` is a count with no names, drawn as small squares. Each `bin role id "Label": the rule | a second line` is one bin, coloured by its role. In a step, `into <bin>: p1, p2..p4` drops those things, or `into <bin>: 12` drops the next 12 left. The block works out the count of each bin, the leftover in the inventory and a running total, and draws them: every thing has one place in the inventory and one reserved slot in its bin, so nothing moves between steps. A narrow screen stacks the bins.

Library returns (one trolley run)
Returned books: 9 books in the inventory (Atlas, Birds, Cooking, Dunes, Engines, Fungi, Gardens, Harbours, Insects). Bins: Science (shelves 500 to 599); Reference (stays in the building); Home (goes back to a branch).
1. Science: Natural history goes to the science shelves.
   Into Science: Birds, Dunes, Fungi, Insects (4 in it now).
   Total: 4 of 9 in bins, 5 left.
2. Reference: Two heavy books stay in the building.
   Into Reference: Atlas, Engines (2 in it now).
   Total: 6 of 9 in bins, 3 left.
3. Branch: Three go back to a branch.
   Into Home: Cooking, Gardens, Harbours (3 in it now).
   Total: 9 of 9 in bins, 0 left.
4. Done: Every book has a bin; the inventory is empty.

The same block with many unnamed things: each square is one thing, the counts do the talking.

Seed packets (60 packets, sorted by season)
Packets by season: 60 packets in the inventory. Bins: Spring (sow in March); Summer (sow in June); Autumn (sow in September).
1. Spring: The first batch is spring seed.
   Into Spring: 24 packets (24 in it now).
   Total: 24 of 60 in bins, 36 left.
2. Summer: Then summer seed.
   Into Summer: 20 packets (20 in it now).
   Total: 44 of 60 in bins, 16 left.
3. Autumn: Twelve go to autumn; four are left over.
   Into Autumn: 12 packets (12 in it now).
   Total: 56 of 60 in bins, 4 left.

A thing can drop again in a later step: it **moves** to another bin, and its old place stays as a dashed outline. `show c` in step 2 makes bin c appear there (its place is reserved from the start); `light c: words` lights a bin with a note in it. `ledger: Photo | Album` (or `... | Album from 0` to number the bins from 0) adds a list of every thing with the number of its bin in each step; a move reads `1 → 3` in the warning tone. A long label wraps inside its chip; it is never cut. `inventory: off` drops the inventory frame when everything is binned in step 1.

Photo albums (nine photos, re-sorted)
Albums: 9 photos (Beach · sunny, Beach · dusk, Hike · summit, Hike · lake, City · night, City · market, Beach · kite, Hike · camp, City · bridge). Bins: 1. Album 1 (the first sort); 2. Album 2 (the first sort); 3. Album 3 (added in step 2), from step 2.
1. Two albums: Nine photos sit in two albums.
   Into Album 1: Beach · sunny, Beach · dusk, Beach · kite, Hike · summit, Hike · lake (5 in it now).
   Into Album 2: City · night, City · market, Hike · camp, City · bridge (4 in it now).
   Total: 9 of 9 in bins, 0 left.
2. Three albums: A third album appears and four photos move to it.
   Album 3 comes in.
   Into Album 3: Hike · summit, Hike · lake, Hike · camp, City · bridge (4 in it now; moved from Album 1, Album 2: Hike · summit, Hike · lake, Hike · camp, City · bridge).
   Total: 9 of 9 in bins, 0 left.
   Album 3: four photos move here.

#### Source: `fixtures/stage/34-animation-bins.dh.md`

````text
---
title: "Animation: bins"
description: A fixture made from the Format page section of the same name (a composed stage).
roles:
  client: c1
  server: c2
  store: c3
  job: c4
  cache: c5
  ops: c6
  plain: c0
---

## Animation: bins

A `bins:` block sorts an inventory into named bins. `items p1..p8: words` names the things (one label for all, or one per id split by `;`); `items 40: word` is a count with no names, drawn as small squares. Each `bin role id "Label": the rule | a second line` is one bin, coloured by its role. In a step, `into <bin>: p1, p2..p4` drops those things, or `into <bin>: 12` drops the next 12 left. The block works out the count of each bin, the leftover in the inventory and a running total, and draws them: every thing has one place in the inventory and one reserved slot in its bin, so nothing moves between steps. A narrow screen stacks the bins.

```animation
title: Library returns | one trolley run
bins: Returned books | books
items b1..b9: Atlas; Birds; Cooking; Dunes; Engines; Fungi; Gardens; Harbours; Insects
bin job s "Science": shelves 500 to 599
bin store r "Reference": stays in the building
bin ops h "Home": goes back to a branch
@step Science: Natural history goes to the science shelves.
into s: b2, b4, b6, b9
@step Reference: Two heavy books stay in the building.
into r: b1, b5
@step Branch: Three go back to a branch.
into h: b3, b7, b8
@step Done: Every book has a bin; the inventory is empty.
```

The same block with many unnamed things: each square is one thing, the counts do the talking.

```animation
title: Seed packets | 60 packets, sorted by season
bins: Packets by season | packets
items 60: packet
bin job a "Spring": sow in March
bin store b "Summer": sow in June
bin ops c "Autumn": sow in September
@step Spring: The first batch is spring seed.
into a: 24
@step Summer: Then summer seed.
into b: 20
@step Autumn: Twelve go to autumn; four are left over.
into c: 12
```

A thing can drop again in a later step: it **moves** to another bin, and its old place stays as a dashed outline. `show c` in step 2 makes bin c appear there (its place is reserved from the start); `light c: words` lights a bin with a note in it. `ledger: Photo | Album` (or `... | Album from 0` to number the bins from 0) adds a list of every thing with the number of its bin in each step; a move reads `1 → 3` in the warning tone. A long label wraps inside its chip; it is never cut. `inventory: off` drops the inventory frame when everything is binned in step 1.

```animation
title: Photo albums | nine photos, re-sorted
bins: Albums | photos
items p1..p9: Beach · sunny; Beach · dusk; Hike · summit; Hike · lake; City · night; City · market; Beach · kite; Hike · camp; City · bridge
bin job a "Album 1": the first sort
bin store b "Album 2": the first sort
bin ops c "Album 3": added in step 2
ledger: Photo | Album
inventory: off
@step Two albums: Nine photos sit in two albums.
into a: p1, p2, p7, p3, p4
into b: p5, p6, p8, p9
@step Three albums: A third album appears and four photos move to it.
show c
light c: four photos move here
into c: p3, p4, p8, p9
```
````

# Every folder part

<!-- generated by scripts/parts.ts from the folders under src/parts/: do not edit -->

# The folder parts

Every part that lives in its own folder, with its sample. The Format page shows each as source, drawing and LLM view.

## Audio

An audio part is a player of our own. The wave is drawn from a small peaks file and moves with the sound; chapters split it, a marker flags one moment, and the transcript follows the voice.

Audio: A page that talks (0:57), media/talk.mp3. Chapters: 0:00 Welcome; 0:24 The transcript; 0:38 The marker. Markers: 0:38 Where the example crashed.

0:00 Ana: Welcome back. Today we look at a page that can talk.
0:04 Ben: A page that talks. Do you mean the audio part?
0:08 Ana: Yes. You write one fence, with a file, a title, and a few lines of transcript.
0:14 Ben: And the reader sees a wave that moves while the voice plays.
0:18 Ana: The wave is drawn from a small peaks file, so it appears before the sound starts.
0:24 Ben: What about people who cannot listen right now?
0:27 Ana: The transcript follows the voice. Tap a line, and the player jumps there.
0:33 Ben: Chapters split the wave into parts, and a marker flags one moment.
0:38 Ana: Here is the marker. This is where the example crashed.
0:42 Ben: And a language model reads the same page as plain text.
0:46 Ana: It gets the title, the chapters, and the transcript, never a picture of a wave.
0:52 Ben: That is the whole part. Press play, and listen again.

`wave=mirror` reflects the wave, `wave=dots` draws it in dots, `wave=live` shows a window of the sound that scrolls past "now", and `compact` makes one row. The colour is a word (`tone=c4`), never a hex value.

Audio: Mirror wave, in family colour 4 (0:57), media/talk.mp3.

Audio: Compact (0:57), media/talk.mp3.

## Calendar

The host supplies no clock here: Today returns to the authored date. Explore the views, switch calendars and open events. A narrow part starts with three days.

Calendar: Release week (times in Europe/London).

Repeats:
- Every weekday 09:00-09:20 from Mon 23 Nov 2026, 5 times: Stand-up (Team)

Events:
- Tue 24 Nov 2026 10:00-11:30: Design review, Studio (Team). Bring the mock-ups
- Tue 24 Nov 2026 10:30-11:00: Review notes (Team).
- Wed 25 Nov 2026, all day: Code freeze.
- Thu 26 Nov 2026 07:00-08:00 (18:00-19:00 on Thu 26 Nov 2026 in Australia/Sydney): Sydney call.

The static form keeps a complete dated list without controls.

Calendar: Release checklist (times in Europe/London).

Repeats:
- Every weekday 09:00-09:20 from Mon 23 Nov 2026, 3 times: Stand-up (Team)

Events:
- Wed 25 Nov 2026, all day: Code freeze.

## Chart kinds

Eight more kinds of a `chart`, each a YAML map with `kind:` at the top: raw values are counted, quartiled or smoothed when the page is built, so a model reads the table. Hover, tap or focus a bin, box, stage, block or day for its card; the arrow keys walk the data.

Chart (histogram): How long a request takes

| from | to | count |
| --- | --- | --- |
| 25 ms | 38.83 ms | 1 |
| 38.83 ms | 52.67 ms | 2 |
| 52.67 ms | 66.5 ms | 3 |
| 66.5 ms | 80.33 ms | 7 |
| 80.33 ms | 94.17 ms | 11 |
| 94.17 ms | 108 ms | 5 |
| 108 ms | 121.83 ms | 7 |
| 121.83 ms | 135.67 ms | 4 |
| 135.67 ms | 149.5 ms | 1 |
| 149.5 ms | 163.33 ms | 1 |
| 163.33 ms | 177.17 ms | 1 |
| 177.17 ms | 191 ms | 1 |

Marks: p50 = 92 ms, p95 = 152.75 ms

requests: 44 values.

Chart (boxplot): Checkout time by day

| day | min (s) | p25 | median | p75 | max | outliers |
| --- | --- | --- | --- | --- | --- | --- |
| Mon | 1m 40s | 1m 51s | 2m 3s | 2m 14s | 2m 49s | 2m 49s |
| Tue | 1m 57s | 2m 13s | 2m 25s | 2m 33s | 2m 56s | none |
| Wed | 1m 56s | 2m 17s | 2m 36s | 2m 42s | 4m 20s | 4m 20s |

Values per category: Mon 14, Tue 14, Wed 14.

Chart (violin): Response time by service

| service | min (ms) | p25 | median | p75 | max | outliers |
| --- | --- | --- | --- | --- | --- | --- |
| api | 57 ms | 90.5 ms | 101 ms | 105 ms | 124 ms | 57 ms |
| search | 119 ms | 148.25 ms | 169 ms | 204 ms | 237 ms | none |
| checkout | 201 ms | 213 ms | 240.5 ms | 247.75 ms | 262 ms | none |

Values per category: api 18, search 18, checkout 18.

Chart (funnel): From visit to paid

Step 1: Last quarter.

| stage | count | of the first | of the one before |
| --- | --- | --- | --- |
| Visited the site | 48,200 | 100% |  |
| Created an account | 8,700 | 18.0% | 18.0% |
| Started a trial | 4,100 | 8.5% | 47.1% |
| Paid | 1,350 | 2.8% | 32.9% |

Step 2: After the shorter sign-up form.

| stage | count | of the first | of the one before |
| --- | --- | --- | --- |
| Visited the site | 49,500 | 100% |  |
| Created an account | 11,300 | 22.8% | 22.8% |
| Started a trial | 5,200 | 10.5% | 46.0% |
| Paid | 1,720 | 3.5% | 33.1% |

Chart (waterfall): Monthly revenue bridge

| step | change (EUR) | running total |
| --- | --- | --- |
| October | start €84,000 | €84,000 |
| New | +€12,500 | €96,500 |
| Churn | -€9,100 | €87,400 |
| Refunds | -€2,300 | €85,100 |
| Subtotal | total | €85,100 |
| Price rise | +€4,800 | €89,900 |
| November | total | €89,900 |

Chart (treemap): Where the disk went

disk use (bytes), total 849.4 GiB:

- Media: 556.9 GiB (65.6%)
  - Videos: 383.7 GiB (45.2%)
  - Photos: 173.2 GiB (20.4%)
- Code: 162.1 GiB (19.1%)
  - Build cache: 82 GiB (9.6%)
  - Repos: 80.1 GiB (9.4%)
- Backups: 130.4 GiB (15.4%)

Chart (sunburst): Lines of code by team and area (thousands)

lines of code, total 341:

- Product: 164 (48.1%)
  - Web: 95 (27.9%)
  - Mobile: 69 (20.2%)
- Platform: 159 (46.6%)
  - Runtime: 93 (27.3%)
  - Storage: 66 (19.4%)
- Docs: 18 (5.3%)

Chart (calendar): Commits, September to November

commits by day, 2026-09-01 to 2026-11-30:

| month | days with data | total | busiest day |
| --- | --- | --- | --- |
| Sep 2026 | 20 | 101 | 2026-09-15 (10) |
| Oct 2026 | 22 | 107 | 2026-10-02 (9) |
| Nov 2026 | 24 | 87 | 2026-11-27 (10) |

Each kind takes `title`, `tone` where it makes sense, `y: { label, format, currency }` for the value axis (the histogram's is `x`), and `steps:` that change `data`, `marks` or `bins` from one step to the next.

## Compare

**A comparison matrix puts options side by side, one line for each thing you judge them on.** The first line names the options; every other line is a criterion and one value for each option, in the same order. A note in round brackets shows when a reader hovers, focuses or taps the value. With `winner=on` the best value of each yes/no, scored or good/bad row is marked; `pick=` flags the option you recommend.

| Which queue? | Redis Streams | Kafka | SQS |
| --- | --- | --- | --- |
| Ordering | **yes** | **yes** | partial (FIFO queues only) |
| Runs itself | no | no | **yes** |
| Throughput | 3 | **5** | 3 |
| Latency (lower is better) | **4 ms (in one region)** | 12 ms | 25 ms |
| Replay old messages | **yes (until trimmed)** | **yes (by offset)** | no |
| Cost at our size | **good** | bad | **good (pay per request)** |
| Team knows it | **yes** | partial (two people) | **yes** |

With `view=single`, a phone shows one option at a time, chosen from buttons. Here the values are plain words and good, warn and bad, so no row is marked as the best.

| Where to host the docs | Own servers | Static host | Wiki service |
| --- | --- | --- | --- |
| Set-up time | a week | an hour | a day |
| Custom domain | good | good | warn (paid plan only) |
| Search | warn (add one) | warn (add one) | good |
| Who can edit | developers | developers | anyone with an account |

## Compare image

**A before-and-after picture lays two images of the same size on top of each other, with a bar between them.** Drag the bar (or anywhere on the picture), press the arrow keys, or tap the picture to flip from one to the other; the two labels jump to a whole image. Each image line gives the address and the alt text in quotes, which is what a screen reader and an LLM read. The address goes through the host's URL policy (a relative path, http or https; never `data:`). The two sample images are the files `before-light.svg` and `after-dark.svg` in this part's `media/` folder: a host serves that folder as `media/`.

A dashboard, light and dark: Light and Dark
- Light: A dashboard with four tiles and a bar chart on a light page
- Dark: The same dashboard on a dark page

## Diff

A `diff` block holds what `git diff` prints. It is drawn as a diff view: a file header with how much changed, line numbers on both sides, the changed words marked inside a changed line, and long unchanged runs folded. It is split on a wide part and unified on a narrow one; the buttons switch it, and `view=split` or `view=unified` fixes it. On a phone the lines do not wrap: the numbers and the sign stay in view while the code scrolls inside its box.

```diff
diff --git a/src/server.ts b/src/server.ts
index 4b825dc..9f3c1a7 100644
--- a/src/server.ts
+++ b/src/server.ts
@@ -12,9 +12,10 @@ export function start(config: Config) {
   const port = config.port ?? 8080;
-  const host = "localhost";
+  const host = config.host ?? "0.0.0.0";
   const server = createServer(handler);
-  server.listen(port, host);
+  server.listen(port, host, () => log.info("listening", { port, host }));
   register(server);
   watch(config);
   return server;
@@ -48,6 +49,6 @@ export function stop(server: Server) {
   unwatch();
-  server.close();
+  server.close(() => log.info("closed"));
 }
@@ -80,18 +81,19 @@ export function reload(server: Server) {
   const next = readConfig();
-  if (next.port !== current.port) restart(server);
+  if (next.port !== current.port || next.host !== current.host) restart(server);
   current = next;
   emit("reload", next);
   mark("reload");
   audit(next);
   notify(next);
   flush();
   settle();
   prune();
   index();
   compact();
   verify();
+  log.debug("reloaded", { port: next.port });
   return server;
 }
```

With `static` the diff is drawn whole, with no button: every file open, and a folded run only says how many lines it holds.

```diff static=
--- a/src/greet.ts
+++ b/src/greet.ts
@@ -1,4 +1,4 @@
 export function greet(name: string) {
-  return "Hello, " + name;
+  return `Hello, ${name}!`;
 }
```

## Downloads

A card for each file: a type icon, its size, a plain download link, and a checksum that copies on a tap, with the line that checks it. Nothing is counted and nothing is fetched until the reader presses Download.

Downloads: Files for this page.
- The report, first pages: media/report.pdf (PDF, 209 KB, sha256 d14bdf...4372)
  sha256: d14bdfa9e9a37c960e8a2835fd6c0e75aa6e201e1e967d18159378e3de124372
- The spoken sample: media/talk.mp3 (MP3, 229 KB, sha256 8ed40d...5d55)
  sha256: 8ed40d5dc963c74c457b987f9af4b4f3a33f1c13aa7a547cd3e959bf6fcd5d55
- The hand-written animation: media/build.json (JSON, 6.4 KB) A Lottie file with no expressions and no images..
- Source archive (an example address): https://example.com/durian-markdown-0.7.0.tar.gz (GZ, 1.2 MB, sha256 2c26b4...e7ae) The address is an example; nothing is fetched until you press Download..
  sha256: 2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae
- Raw data: media/requests.csv (CSV, 15.4 KB) One row per request..

## Explore

A fence in the data's own language, followed by `explore`, becomes a foldable tree with a search box, a copy-path button on every key and a **jq subset** query box. It reads JSON, YAML or CSV (a CSV's rows become objects). `query=` is the starting query. The box runs our own small jq (the "jq subset": paths, pipes, `select`, `map`, `keys`, `length`, `sort_by`, `group_by`, `to_entries`, `test`, string interpolation, building objects and arrays); a query that needs more work than a page may use says so, and a function outside the subset is named, never answered wrongly. It lacks assignment (`|=`), `reduce`, `foreach`, `def`, `paths`, `del`, `sub`, `gsub`, `match` and `walk`.

```json explore query=".lines[] | select(.qty > 1)"
{
  "id": "o-7",
  "customer": { "id": "c-12", "name": "Ana", "tags": ["vip", "early"] },
  "lines": [
    { "sku": "tea", "qty": 2, "price": 3.5 },
    { "sku": "cup", "qty": 1, "price": 8 },
    { "sku": "pot", "qty": 3, "price": 12.25 }
  ],
  "paid": true,
  "note": null
}
```

Query `.lines[] | select(.qty > 1)` gives:
{"sku":"tea","qty":2,"price":3.5}
{"sku":"pot","qty":3,"price":12.25}

The same reader takes YAML and CSV. TOML exploration is refused until a TOML reader is available; the TOML example below is ordinary code:

```yaml explore query=".limits | map_values(ascii_upcase)"
service: shop
replicas: 3
limits:
  cpu: 500m
  mem: 256Mi
hosts:
  - name: app-1.example.com
    zone: a
  - name: app-2.example.com
    zone: b
```

Query `.limits | map_values(ascii_upcase)` gives:
{"cpu":"500M","mem":"256MI"}

```toml
[server]
host = "198.51.100.7"
port = 8443
tls = true

[limits]
cpu = "500m"
```

```csv explore query="sort_by(.p95) | reverse | .[0].region"
region,p50,p95,requests
us-west,42,120,1200000
eu-central,55,180,830000
ap-south,70,260,410000
```

Query `sort_by(.p95) | reverse | .[0].region` gives:
"ap-south"

## Fishbone

Causes by category along a spine into the effect. In a narrow column the spine turns vertical.

Fishbone: Why is checkout slow? Effect: Checkout takes 4 seconds at p95. Causes by category:
- People
  - on-call is new to the service
- Process
  - no load test before a release
    - only staging has real data
- Tools
  - the ORM loads every line item
    - one query per line
- Environment
  - the database is in another region

With steps, the bones come in one at a time, and `highlight` lights one.

Fishbone: Why did the deploy fail? Effect: The deploy rolled back. Causes by category:
- Config
  - a key was renamed in one place only
- Tests
  - the contract test was skipped
- Release
  - two services shipped in the wrong order

Steps:
1. The first two causes.
2. The third, and the one to fix first.

## Flame chart and flame graph

A traced request and folded profiler stacks. Tap a frame to zoom; search highlights matching frames.

Flame chart: One request, traced (ms). Each line is a call: its name, when it started and ended, and how long it took; indented lines are inside the line above.

request 0–120 (120 ms)
  auth.check 2–14 (12 ms)
  handler.order 15–95 (80 ms)
    db.query 16–70 (54 ms)
    render.page 72–90 (18 ms)
  respond.write 96–118 (22 ms)

Flame graph: CPU, 30 seconds (samples). 730 in all.

Stacks (the samples in each, biggest first):

| stack | count | share |
| --- | --- | --- |
| main;serve;handle;db.query | 300 | 41.1% |
| main;serve;handle;parse | 120 | 16.4% |
| main;serve;handle;render.page | 95 | 13% |
| main;serve;handle;db.query;lock.wait | 80 | 11% |
| main;housekeeping;flush | 60 | 8.2% |
| main;serve;gc | 45 | 6.2% |
| main;serve;accept | 30 | 4.1% |

Functions by their own time:

| function | self | share |
| --- | --- | --- |
| db.query | 300 | 41.1% |
| parse | 120 | 16.4% |
| render.page | 95 | 13% |
| lock.wait | 80 | 11% |
| flush | 60 | 8.2% |
| gc | 45 | 6.2% |
| accept | 30 | 4.1% |

## Gallery

A carousel shows one image at a time: swipe, use the arrow keys, the buttons or the dots. A tap opens the picture full screen, where pinch, wheel and double tap zoom it, and one finger or the mouse pans.

Gallery: Four sample pictures (4 images).
1. A harbour at dawn: a low sun over a still sea (media/harbour.svg): Harbour at dawn: a made-up picture for the sample
2. A pine forest in green light (media/forest.svg): Pine forest
3. Sand dunes under a pale sky (media/dunes.svg): Dunes at noon
4. A mountain behind a lake (media/lake.svg): Mountain lake

A grid crops to a ratio (the full picture stays in the lightbox), with the caption under each image.

Gallery: The same pictures, as a grid (4 images).
1. A harbour at dawn (media/harbour.svg): Harbour
2. A pine forest (media/forest.svg): Forest
3. Sand dunes (media/dunes.svg): Dunes
4. A mountain lake (media/lake.svg): Lake

One image, with zoom.

Gallery: images (1 image).
1. A mountain behind a lake (media/lake.svg): Tap the picture to see it full screen

## Gantt

A task line is `<id> "label" <start> <end or length> [progress%] [done] [colour]`; a start is a date or `after <id> ...`; `milestone` is a point; `section` groups the lines after it. `today=` draws a line (never the real clock). Hover, tap or focus a bar for its dates and what it waits for; Day, Week and Month change the scale.

Gantt: Release 2.0. Today is 2026-12-09.

Build

| task | start | end | after |
| --- | --- | --- | --- |
| Design (done) | 2026-12-01 | 2026-12-04 |  |
| API (60%) | 2026-12-05 | 2026-12-12 | Design |
| Screens | 2026-12-05 | 2026-12-10 | Design |

Ship

| task | start | end | after |
| --- | --- | --- | --- |
| Beta | 2026-12-13 | 2026-12-15 | API, Screens |
| Launch (milestone) | 2026-12-16 |  | Beta |

Under steps, `progress`, `done` and `move` change the plan as time passes; a slip carries the tasks after it. `workdays=on` makes lengths skip Saturday and Sunday, and `critical=on` outlines the longest chain.

Gantt: A release that slips. Lengths skip Saturday and Sunday. Today is 2026-12-14.

Step 1: The plan on 1 December

Build

| task | start | end | after |
| --- | --- | --- | --- |
| Design (done) | 2026-12-01 | 2026-12-04 |  |
| API (40%) | 2026-12-07 | 2026-12-16 | Design |
| Screens | 2026-12-07 | 2026-12-14 | Design |

Test

| task | start | end | after |
| --- | --- | --- | --- |
| QA | 2026-12-17 | 2026-12-23 | API, Screens |

Critical chain (the longest run of "after"s): Design, API, QA.

Step 2: Design is done, the API is under way

| task | start | end | after |
| --- | --- | --- | --- |
| API (60%) | 2026-12-07 | 2026-12-16 | Design |
| Screens (100%) | 2026-12-07 | 2026-12-14 | Design |

Step 3: The API slips by a week

| task | start | end | after |
| --- | --- | --- | --- |
| API (60%) | 2026-12-14 | 2026-12-23 | Design |
| QA | 2026-12-24 | 2026-12-30 | API, Screens |
| Launch (milestone) | 2026-12-31 |  | QA |

## Glossary

Terms defined once. Where a term is used in the text, its first use in each section is a button with a dotted underline: hover it, tap it, or focus it and press Enter to read the meaning.

Glossary:
- **UL** (also: ubiquitous language): the words a team agrees on and uses in code and in talk
- **bounded context** (also: context map): one part of the system with its own **words**; see [the book](https://example.com/ddd)

Each team keeps its own UL inside a bounded context. The second use of UL in the same section stays plain text: UL.

## Graph

A graph is for finding your way around a big network: what uses what, and what breaks if one part goes. Write `group` and `node` lines, then one edge a line (`a -> b`, with a label in quotes if it needs one). A node an edge names and no line declares is added (here the outside libraries). `layout=layers` puts each package above what it uses. **Explore it:** search a package, tap one to focus it and its neighbours (1 or 2 steps out), fold a group into one box, pan and zoom; the list beside the graph shows its links in and out. A graph this size reads as over 400 tokens, so the `:::llm` after it says the same in short.

A layered package graph of a shop: 33 packages in 6 groups, plus 7 outside libraries (react, chart.js, zod, pg, ioredis, undici, date-fns); 80 edges. The apps (web shop, admin console, background worker, command line) use the user interface packages (ui-kit, charts, forms, icons, theme) and the domain packages (cart, checkout, catalog, accounts, search, pricing, orders, money, auth). The domain uses data access (db, cache, queue, events, http-client, storage), which uses core (config, log, errors, util, i18n, time). Checkout needs cart, orders, money and auth; auth needs db, cache and errors. Most connected: db (6 in, 4 out), config (7 in, 2 out), web (8 out), catalog (5 in, 3 out).

`layout=force` pulls linked services together and pushes the rest apart, so the clusters show. It fits calls between services, where there is no top or bottom. An id may carry a numbered range: `node db-orders-{1..6} in data` declares six shards, and `orders -> db-orders-{1..6}` draws a line to each. **Fold a group** (beside the graph, or a double tap on its box) and its lines join on one box with a count; **Fold groups** folds them all. A graph over 300 nodes, or one that would be drawn too small to touch in its box (a phone), starts with every group folded. Its LLM view is the nodes by group, the edges as `a -> b` lines, and the most connected nodes: here far over 400 tokens, so a `:::llm` says it in short.

A force-laid call graph of a shop: 120 services in 8 groups, 232 calls. Edge (cdn, waf, gateway, three backends for web, mobile and admin, graphql, ws-hub ...) calls identity (auth, sessions, users, tokens, mfa, sso ...) and catalog (catalog-api, products, prices, search-api, recs ...). Checkout calls cart-api, tax, shipping-quote, fraud, loyalty, pay-api and orders-api; orders-api writes six shards, db-orders-1 to db-orders-6. pay-api calls card-vault, two payment providers, wallets, three-ds and the ledger. Events go through event-bus to fulfilment (warehouses, picking, packing, labels, carriers, tracking), the indexer, notify, the warehouse (dw) and audit. Platform: config, flags, secrets, kms, metrics, logs, traces, the mesh, scheduler and jobs. Most connected: orders-api (5 in, 9 out), auth, catalog-api, pay-api, event-bus (6 in, 5 out).

`layout=radial centre=<node>` puts one node in the middle and each ring one step further away, in either direction: what it uses and what uses it. Use it to answer "what touches this?". A small graph needs no `:::llm`: its LLM view is the graph itself, as lines.

Graph "What touches the sign-in service": 12 nodes in 2 groups, 12 edges (a -> b: a links to b).

Nodes by group:
- callers "calls sign-in": web, mobile, admin, cli
- needs "sign-in calls": sessions, users, mfa, tokens
- in no group: auth "sign-in", sms, kms, postgres

Edges:
web -> auth
mobile -> auth
admin -> auth
cli -> auth
auth -> sessions
auth -> users
auth -> mfa
auth -> tokens
mfa -> sms: codes
tokens -> kms: signing keys
sessions -> postgres
users -> postgres

Most connected: auth (4 in, 4 out), sessions (1 in, 1 out), users (1 in, 1 out), mfa (1 in, 1 out), tokens (1 in, 1 out).

`static` draws the part still: the groups with how many nodes each holds, and a line that counts the edges between two groups. It is for print, a PDF, an email, or a reader who asks for less motion.

Graph "The same sign-in graph, drawn still": 12 nodes in 2 groups, 12 edges (a -> b: a links to b).

Nodes by group:
- callers "calls sign-in": web, mobile, admin, cli
- needs "sign-in calls": sessions, users, mfa, tokens
- in no group: auth "sign-in", sms, kms, postgres

Edges:
web -> auth
mobile -> auth
admin -> auth
cli -> auth
auth -> sessions
auth -> users
auth -> mfa
auth -> tokens
mfa -> sms: codes
tokens -> kms: signing keys
sessions -> postgres
users -> postgres

Most connected: auth (4 in, 4 out), sessions (1 in, 1 out), users (1 in, 1 out), mfa (1 in, 1 out), tokens (1 in, 1 out).

## Http

An `http` block is a request and, after a blank line, its response, as text. It is drawn as a method tag and the address (the query split into names and values), the headers (folded after six), the body (JSON is pretty and can be folded), the status as a tag coloured by its class, and a button that copies the request as `curl`. A secret in a header is never written out: use a placeholder such as `<token>`.

```http
POST /v1/orders?dry_run=false&currency=usd HTTP/1.1
Host: api.example.com
Content-Type: application/json
Accept: application/json
Authorization: Bearer <token>
Idempotency-Key: 6f1c2d0e
User-Agent: shop-cli/2.4
X-Request-Id: req-7a91

{ "sku": "tea", "qty": 2, "ship": { "to": "198.51.100.7", "express": true }, "notes": ["gift", "no receipt"] }

HTTP/1.1 201 Created
Content-Type: application/json
Location: /v1/orders/o-7

{ "id": "o-7", "status": "open", "total": { "amount": 1840, "currency": "usd" } }
```

With `static` the whole message is drawn: every header, the whole JSON tree, no button.

```http static=
HTTP/1.1 404 Not Found
Content-Type: application/json
Cache-Control: no-store

{ "error": "not_found", "detail": { "resource": "order", "id": "o-9" } }
```

## Log

A fence named `log`. It reads JSON lines, logfmt and the common "time level message key=value" shape. The filter box speaks **LogQL** (Grafana Loki's query language): `{level="error"}`, `|= "timeout"`, `!= "health"`, `|~ "5\\d\\d"`, `| status >= 500`; a box that starts with neither `{` nor `|` is plain words. Only the query half of LogQL is read, never metric queries. `filter=` is the starting filter. The author (often an agent) points at what matters with `@highlight` lines: a LogQL filter or `line 3-5`, a colour word and the reason in quotes.

Highlights: lines 4-5 match |= "timeout": every failure is the same timeout; line 3: the first sign.

```log labels="app=shop, env=prod" filter={level=~"warn|error"}
2026-11-20T10:08:01Z info  deploy started version=1.4
2026-11-20T10:08:12Z info  migration applied name=0042
2026-11-20T10:09:03Z warn  cache miss rate high rate=0.41
2026-11-20T10:09:05Z error request failed path=/cart status=500 err="timeout after 30s" span=checkout trace=request (×2)
```

## Lottie

A Lottie file is a drawing that moves. This one was written by hand for the sample: a box fills with blocks, one row at a time, then a tick appears. It plays while it is on screen, stops off it, and shows one still frame when the reader asks for less motion. The `colours:` line maps names inside the file to theme colours, so it follows light and dark.

Lottie animation: What happens while it builds. A box fills with blocks, one row at a time, then a tick appears.

## Map and routes

Places and written routes work without a tile provider. A dashed route has no road geometry; the host may supply its own router.

Map: Walk to the garden.

Places:
- Library (51.507, -0.128): Meet by the entrance
- Garden (51.511, -0.117)

Routes:
- Morning walk, on foot: Library -> 51.508, -0.123 -> Garden (about 900 m in a straight line)

Steps:
1. Meet at the library.
2. Follow the written route.

Country values, US states and flows share the same map and value list.

Map: Daily flow.

Values: 3 regions, from 39.5 to 83.2.

| region | value (units per day) |
| --- | --- |
| Germany | 83.2 |
| France | 68.4 |
| California | 39.5 |

Arcs:
- Germany -> France: 24 units per day (Daily flow)

The globe uses the same data; with no WebGL it falls back to the flat map.

Map: Global flow.

Values: 2 regions, from 68.4 to 83.2.

| region | value (units per day) |
| --- | --- |
| Germany | 83.2 |
| France | 68.4 |

Arcs:
- Germany -> France: 24 units per day (Daily flow)

Shown as a turning globe.

A static globe is a flat map with all its values, ready to print.

Map: A still map.

Values: 2 regions, from 68.4 to 83.2.

| region | value |
| --- | --- |
| Germany | 83.2 |
| France | 68.4 |

Shown as a turning globe.

## Maths (`$...$`, `$$...$$` and `math`)

The area of a circle is $A = \pi r^2$, and a sum of the first $n$ numbers is:

$$
\sum_{k=1}^{n} k = \frac{n(n+1)}{2}
$$

The same in a `math` block, with a fraction, a root and a matrix:

$$
x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a} \qquad
\begin{pmatrix} 1 & 0 \\ 0 & 1 \end{pmatrix}
$$

Prices stay text: it costs $5 and $10, and `$not maths$` in code is left alone.

## PDF

pdf.js draws the pages on a canvas, and its text layer makes the words selectable and searchable. The file below was printed from a small made-up document. The viewer works a page at a time; try the search box, the outline and the zoom.

PDF: A sample document, media/sample.pdf.

`view=scroll` lays every page out in one scrolling column and draws the ones near the window.

PDF: The same file, scrolling, media/sample.pdf.

## Citations (`[@key]` and `references`)

A mark in the text opens its entry: marks make a study easier to read [@smith2020, p. 12], and two together are one group [@smith2020; @lee2019]. Hover, focus or tap a mark for the entry.

References:
- [lee2019] Lee, K. (2019). Notes on lists. Example Press. Retrieved November 20, 2026, from https://example.com/notes
- [smith2020] Smith, J., & Lee, K. (2020). A study of marks. Journal of Studies, 12(3), 10-20. https://doi.org/10.1234/jbs.2020.4

## Sankey

A flow a line, `from -> to: amount`; `node <id> "label" [colour]` only to name or colour one. Hover, tap or focus a band to light its path and read its share.

Sankey: Where a request's time goes (ms).

| from | to | amount (ms) |
| --- | --- | --- |
| request | auth | 12 |
| request | handler | 80 |
| handler | Postgres | 55 |
| handler | render | 20 |
| handler | Redis | 5 |

Flows under a step appear in it: the bands grow out of their source. In a narrow column, a sankey with more than three columns runs top to bottom.

Sankey: Where the month's budget goes (USD).

Step 1: The money in and the big three

| from | to | amount (USD) |
| --- | --- | --- |
| Revenue | People | 62000 |
| Revenue | Infrastructure | 21000 |
| Revenue | tools | 6000 |
| Revenue | reserve | 11000 |

Step 2: Infrastructure breaks down

| from | to | amount (USD) |
| --- | --- | --- |
| Infrastructure | compute | 12500 |
| Infrastructure | storage | 5200 |
| Infrastructure | network | 3300 |

Step 3: Compute splits by team

| from | to | amount (USD) |
| --- | --- | --- |
| compute | web | 7000 |
| compute | data | 4100 |
| compute | ml | 1400 |

## Sequence

Who calls whom, in order. A call is a solid arrow, a reply a dashed one; a block (`loop`, `alt`, `opt`, `par`) frames the messages inside it. An LLM reads the messages as a numbered list.

Sequence: One init call. Participants: developer (actor), CLI, template container.

1. dev -> cli: scaffold create
2. cli -> tc: init call, all answers
3. tc --> cli: question reply
note tc: the script stopped at a question
loop until no question is left:
   4. cli -> tc: init call, one more answer
   5. tc --> cli: question reply
6. cli --> dev: project written

With `@step` lines the story builds up one call a step: the earlier calls fade and the new one draws itself.

Sequence. Participants: CLI, template container.

The CLI sends an init call with every answer it holds.
1. cli -> tc: init call: all answers
The script stops at a question and sends it back.
2. tc --> cli: question reply
The next init call carries one answer more.
3. cli -> tc: init call: one more answer

## Sparkline in a sentence (`:spark[...]`)

`:spark[3,5,2,8,9]` draws a tiny line the height of the text. Add `bar` for bars and a colour word for the colour: `:spark[3,5,2,8,9 bar good]`. Hover, tap or focus it to see the numbers. A model reads `(3, 5, 2, 8, 9)`.

Sign-ups this week were (120, 135, 128, 160, 182, 171, 205) and rising, errors fell to (14, 12, 15, 9, 7, 4, 3), and the queue is (5, 4, 6, 22, 31, 18, 9) after Wednesday's spike.

## Stacktrace

A fence named `stacktrace`. It reads a trace as printed by Go, .NET, Bun or Node, Dart, Java or Python: the error line, each cause in its own block, threads as groups. Library frames fold into one bar; frames of your own code (`app=`) are marked, and with `repo=` and `strip=` they name the file and line at the page’s pinned commit (when its front matter has a matching pins entry). Tap a frame to open it.

```stacktrace lang="go" app="example.com/shop" repo="example.com/shop" strip="/src/shop/"
panic: runtime error: index out of range [3] with length 3

goroutine 18 [running]:
example.com/shop/cart.(*Cart).Item(...)
	/src/shop/cart/cart.go:42
example.com/shop/api.(*Server).getItem(0xc0001a2000, {0x7f1c, 0xc000124000}, 0xc000188000)
	/src/shop/api/items.go:88 +0x1d4
net/http.HandlerFunc.ServeHTTP(0xc000010040, {0x7f1c, 0xc000124000}, 0xc000188000)
	/usr/local/go/src/net/http/server.go:2136 +0x29
net/http.serverHandler.ServeHTTP({0xc00011e000}, {0x7f1c, 0xc000124000}, 0xc000188000)
	/usr/local/go/src/net/http/server.go:2938 +0x8e
```

## Stack traces in the other five languages

`lang=` may be left out when the trace says it. Each trace below is read by its own parser.

```stacktrace app="Acme.Shop"
System.InvalidOperationException: Cart failed
 ---> System.ArgumentException: Index out of range (Parameter 'i')
   at Acme.Shop.Cart.Item(Int32 i) in /src/shop/Cart.cs:line 42
   at System.Linq.Enumerable.First[TSource](IEnumerable`1 source)
   --- End of inner exception stack trace ---
   at Acme.Shop.Api.GetItem(Int32 id) in /src/shop/Api.cs:line 88
   at Microsoft.AspNetCore.Mvc.Invoke()
```

```stacktrace app="/src/shop"
Error: request failed
    at fetchItem (file:///src/shop/api.ts:42:11)
    at async handler (/src/shop/server.ts:10:3)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at run (/src/shop/node_modules/lib/index.js:5:9)
Caused by: TypeError: bad json
    at parse (/src/shop/util.ts:7:2)
```

```stacktrace app="shop"
Unhandled exception:
Bad state: no element
#0      Cart.item (package:shop/cart.dart:42:7)
#1      Api.get (package:shop/api.dart:10:3)
<asynchronous suspension>
#2      _rootRunUnary (dart:async/zone.dart:1407:47)
#3      State.setState (package:flutter/src/widgets/framework.dart:1100:9)
```

```stacktrace app="com.acme.shop"
java.lang.IllegalStateException: cart failed
	at com.acme.shop.Cart.item(Cart.java:42)
	at com.acme.shop.Api.get(Api.java:88)
	at java.base/java.util.ArrayList.get(ArrayList.java:427)
	... 12 more
Caused by: java.io.IOException: boom
	at com.acme.shop.Db.read(Db.java:7)
	... 5 common frames omitted
```

```stacktrace app="/src/app"
Traceback (most recent call last):
  File "/src/app/db.py", line 5, in read
    raise OSError("boom")
OSError: boom

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/src/app/main.py", line 10, in <module>
    run()
  File "/usr/lib/python3.11/site-packages/x.py", line 5, in run
    raise ValueError("bad")
ValueError: bad
```

## Stats

**Stat tiles are the row of big numbers at the top of a dashboard:** each tile is one figure with its name, how it changed and, if given, a tiny line of its recent values, so a reader takes in the state of something at a glance before reading on. The colour word in brackets says whether the change is good or bad (a fall in latency is good); it is never guessed from the sign.

Stat tiles: The week.
- Requests: 1.2 M (+12%, last 7 days)
- p95 latency: 180 ms (-8%)
- Errors: 0.4% (+0.1, of requests)
- Cost: USD 412 (+3%)

A tile can also carry a glyph, a trend word and a sub-line. This block is `static`: it draws the tiles whole, the same in print.

Stat tiles: Garden at a glance.
- Yield: 251 kg (+8%, this season, Across three plots, trend up)
- Water: 120 L (-6%, this week, Stored rainwater, trend down)
- Beds: 30 (Ready for planting, trend flat)

## Timeline

One line per event, oldest first; an indented line is a detail. A year, a month or a day.

Timeline: A release plan.
- 2026-05-04: Design review — Scope and owners agreed
- 2026-09: First release
- 2026-11-21: Old drawing code removed — New drawn parts take their place
- 2026-11-23: Version 2 ships (the big one)

With `dir=across` a wide screen lays it out sideways; a phone is always top to bottom. With steps, the events come in one group at a time.

Timeline: A build-up.
- 2026: The idea
The first half of the year.
- 2026-03: A prototype
- 2026-06: A first user
The second half.
- 2026-09: First release
- 2026-12: Version 2

## Trace waterfall

A request across services. Fold spans, search, zoom the mini map, or switch to Flame.

One checkout request, 842 ms, across 8 services. The payment provider call (258–804 ms) timed out, so charge.card and the request failed with a 504, and a retry was queued. Stock was reserved in parallel with the cart load and is not on the critical path; UPDATE stock in db waited 94 ms on a row lock.

Trace: GET /health. 3 spans across 3 services (web, api, db); 9 ms in all. Each line is a span: its service, name, when it started and ended (ms) and how long it took; indented lines are inside the line above; "log" lines belong to the span above them.

web GET /health 0–9 (9 ms)
  api health.check 1–8 (7 ms)
    db SELECT 1 2–6 (4 ms)

Critical path (what the end waited for): GET /health > health.check > SELECT 1

Slowest spans (by the time each ran itself, children left out):
- SELECT 1 (db): 4 ms of its own, 4 ms in all
- health.check (api): 3 ms of its own, 7 ms in all
- GET /health (web): 2 ms of its own, 9 ms in all

Errors: none.

Trace: A flat list. 4 spans across 3 services (web, api, db); 60 ms in all. Each line is a span: its service, name, when it started and ended (ms) and how long it took; indented lines are inside the line above; "log" lines belong to the span above them.

web GET /orders 0–60 (60 ms)
  api orders.list 3–55 (52 ms)
    db SELECT orders 8–40 (32 ms) rows=25
    api orders.render 41–54 (13 ms)

Critical path (what the end waited for): GET /orders > orders.list > SELECT orders > orders.render

Slowest spans (by the time each ran itself, children left out):
- SELECT orders (db): 32 ms of its own, 32 ms in all
- orders.render (api): 13 ms of its own, 13 ms in all
- GET /orders (web): 8 ms of its own, 60 ms in all
- orders.list (api): 7 ms of its own, 52 ms in all

Errors: none.

## Venn

Two to four sets in fixed, even shapes. It is not drawn to scale on purpose: the names are written in the regions. Hover, tap or focus a region to read its items; on a narrow screen they are listed under the figure.

Venn: Who writes what. Sets: Go, Rust, Zig.
Go only: Ana, Ben
Rust only: Eve, Fay
Zig only: 4 people
Go and Rust only: Cy
all three: Dee (writes all three)

With steps, one set comes in at a time, with its regions.

Venn: Adding one set at a time. Sets: Readers, Writers, Reviewers.
Readers and writers overlap.
Readers only: Ana, Ben
Writers only: Dee
Readers and Writers only: Cy
Reviewers join; some people do all three.
Reviewers only: Eve
all three: Fay

## Video

A video part keeps the browser's video and draws its own controls: a big play button on the poster, a bar with the chapters as segments (point at it to see the chapter and a still), captions drawn by us from a WebVTT file, picture in picture and full screen. The picture here is a made-up moving gradient.

Video: Colours drifting (0:12), media/sample.mp4. Chapters: 0:00 Warm; 0:04 Cool; 0:08 Bright. Captions: English.

0:00 The colours drift slowly across the frame.
0:04 Captions are drawn by the part from a WebVTT file.
0:08 Press C to turn them off, and F for full screen.

`clip` is for a short screen recording that would otherwise be a GIF: it plays muted and in a loop while it is on screen, stops when it scrolls away, and stays still when the reader asks for less motion.

Video: A short silent loop, media/clip.mp4.

## Wardley map

Components by evolution (left to right) and visibility (top to bottom). Positions are named keys, so the two numbers cannot be swapped.

Wardley map: A tea shop. Evolution left to right: genesis, custom built, product, commodity; visibility top to bottom.

| component | evolution | visible |
| --- | --- | --- |
| Customer (anchor) | product (0.60) | 0.95 |
| Cup of tea | product (0.60) | 0.80 |
| Tea | commodity (0.80) | 0.60 |
| Kettle | custom built (0.40) | 0.45 |
| Power | commodity (0.85) | 0.10 |

Customer needs Cup of tea
Cup of tea needs Tea, Kettle
Kettle needs Power
Kettle evolves to product (0.65) as "smart kettle"
Note (genesis (0.10), visible 0.30): Kettles are a product now

Steps:
1. Today the kettle is a product we buy.
2. A smart kettle moves it further to the right.

## Weather

A forecast written in the source; it never fetches. The units menu on the part switches °C and °F, km/h, mph, m/s and knots, mm and inches, hPa and inHg, and your choice is remembered in this browser.

Weather: San Francisco, times in America/Los_Angeles. Temperatures are given in °C and °F.

| day | sky | high / low | rain | wind | pressure |
| --- | --- | --- | --- | --- | --- |
| Sun 22 Nov 2026 | sunny | 18 °C (64 °F) / 11 °C (52 °F) | 0% | 12 km/h | 1021 hPa |
| Mon 23 Nov 2026 | partly cloudy | 16 °C (61 °F) / 10 °C (50 °F) | 10% | 15 km/h | 1018 hPa |
| Tue 24 Nov 2026 | rain | 14 °C (57 °F) / 9 °C (48 °F) | 80%, 6 mm | 30 km/h | 1004 hPa |
| Wed 25 Nov 2026 | storm | 13 °C (55 °F) / 8 °C (46 °F) | 95%, 14 mm | 45 km/h | 996 hPa |
| Thu 26 Nov 2026 | cloudy | 12 °C (54 °F) / 7 °C (45 °F) | 30%, 1 mm | 20 km/h | 1009 hPa |

Notes:
- Wed 25 Nov 2026: Ferry may stop

Hours work the same way, with one temperature, here written in °F and mph.

Weather: Oakland, times in America/Los_Angeles. Temperatures are given in °C and °F.

| time | sky | temperature | rain | wind |
| --- | --- | --- | --- | --- |
| Tue 24 Nov 2026 06:00 | fog | 9 °C (48 °F) | 5% | 4 mph |
| Tue 24 Nov 2026 09:00 | cloudy | 11 °C (52 °F) | 20% | 8 mph |
| Tue 24 Nov 2026 12:00 | drizzle | 14 °C (57 °F) | 60% | 11 mph |
| Tue 24 Nov 2026 15:00 | rain | 15 °C (59 °F) | 85% | 14 mph |
| Tue 24 Nov 2026 18:00 | rain | 13 °C (55 °F) | 70% | 12 mph |
| Tue 24 Nov 2026 21:00 | cloudy | 11 °C (51 °F) | 25% | 7 mph |

The same forecast with `static`: drawn whole in the fence's unit, with no menu.

Weather: Sydney. Temperatures are given in °C and °F.

| day | sky | high / low | rain | wind |
| --- | --- | --- | --- | --- |
| Sun 22 Nov 2026 | sunny | 24 °C (75 °F) / 17 °C (63 °F) | 0% | 14 km/h |
| Mon 23 Nov 2026 | partly cloudy | 22 °C (72 °F) / 16 °C (61 °F) | 20% | 18 km/h |
| Tue 24 Nov 2026 | sleet | 3 °C (37 °F) / -1 °C (30 °F) | 70% | 22 km/h |

Notes:
- Tue 24 Nov 2026: Ice on the road

#### Source: `fixtures/parts/samples.dh.md`

````text
---
title: The folder parts
---
<!-- generated by scripts/parts.ts from the folders under src/parts/: do not edit -->

# The folder parts

Every part that lives in its own folder, with its sample. The Format page shows each as source, drawing and LLM view.

## Audio

An audio part is a player of our own. The wave is drawn from a small peaks file and moves with the sound; chapters split it, a marker flags one moment, and the transcript follows the voice.

```audio src="media/talk.mp3" title="A page that talks" duration=0:57 wave=bars skip=10 transcript=open
peaks: media/talk.peaks.json
chapter 0:00 Welcome
chapter 0:24 The transcript
chapter 0:38 The marker
marker 0:38 Where the example crashed [bad]
0:00 Ana: Welcome back. Today we look at a page that can talk.
0:04 Ben: A page that talks. Do you mean the audio part?
0:08 Ana: Yes. You write one fence, with a file, a title, and a few lines of transcript.
0:14 Ben: And the reader sees a wave that moves while the voice plays.
0:18 Ana: The wave is drawn from a small peaks file, so it appears before the sound starts.
0:24 Ben: What about people who cannot listen right now?
0:27 Ana: The transcript follows the voice. Tap a line, and the player jumps there.
0:33 Ben: Chapters split the wave into parts, and a marker flags one moment.
0:38 Ana: Here is the marker. This is where the example crashed.
0:42 Ben: And a language model reads the same page as plain text.
0:46 Ana: It gets the title, the chapters, and the transcript, never a picture of a wave.
0:52 Ben: That is the whole part. Press play, and listen again.
```

`wave=mirror` reflects the wave, `wave=dots` draws it in dots, `wave=live` shows a window of the sound that scrolls past "now", and `compact` makes one row. The colour is a word (`tone=c4`), never a hex value.

```audio src="media/talk.mp3" title="Mirror wave, in family colour 4" wave=mirror tone=c4 height=s duration=0:57
peaks: media/talk.peaks.json
```

```audio src="media/talk.mp3" title="Compact" compact wave=line duration=0:57
peaks: media/talk.peaks.json
```

## Calendar

The host supplies no clock here: Today returns to the authored date. Explore the views, switch calendars and open events. A narrow part starts with three days.

```calendar title="Release week" tz=Europe/London date=2026-11-23 view=week hours=08-18
calendar team "Team" [c2]
2026-11-23 09:00-09:20 Stand-up in team every weekday times=5
2026-11-24 10:00-11:30 Design review @ Studio in team note="Bring the mock-ups"
2026-11-24 10:30-11:00 Review notes in team
2026-11-25 all day Code freeze [warn]
2026-11-26 18:00-19:00 Sydney call tz=Australia/Sydney
```

The static form keeps a complete dated list without controls.

```calendar title="Release checklist" tz=Europe/London date=2026-11-23 static
calendar team "Team" [c2]
2026-11-23 09:00-09:20 Stand-up in team every weekday times=3
2026-11-25 all day Code freeze [warn]
```

## Chart kinds

Eight more kinds of a `chart`, each a YAML map with `kind:` at the top: raw values are counted, quartiled or smoothed when the page is built, so a model reads the table. Hover, tap or focus a bin, box, stage, block or day for its card; the arrow keys walk the data.

```chart
kind: histogram
title: How long a request takes
x: { label: latency, format: duration-ms }
y: { label: requests }
bins: 12
marks: [p50, p95]
data: [74, 88, 109, 110, 86, 88, 122, 87, 132, 140, 93, 50, 99, 127, 56, 69, 80, 114, 67, 66, 89, 95, 125, 102, 120, 73, 91, 107, 42, 78, 75, 99, 155, 115, 25, 54, 113, 82, 84, 85, 94, 121, 168, 191]
```

```chart
kind: boxplot
title: Checkout time by day
x: { label: day, values: [Mon, Tue, Wed] }
y: { label: seconds to pay, format: duration }
tone: c4
data:
  - [120, 100, 121, 110, 106, 125, 169, 146, 134, 102, 132, 128, 114, 152]
  - [173, 121, 152, 144, 132, 143, 153, 117, 130, 134, 146, 176, 149, 166]
  - [118, 116, 162, 140, 161, 166, 136, 170, 158, 138, 126, 160, 154, 260]
```

```chart
kind: violin
title: Response time by service
x: { label: service, values: [api, search, checkout] }
y: { label: response, format: duration-ms }
tone: c2
data:
  - [57, 69, 117, 111, 105, 83, 98, 105, 124, 101, 88, 102, 117, 83, 99, 101, 101, 99]
  - [141, 198, 207, 164, 144, 149, 163, 206, 121, 232, 154, 227, 237, 119, 174, 148, 195, 192]
  - [243, 242, 239, 262, 246, 212, 247, 222, 252, 201, 213, 203, 204, 248, 234, 261, 258, 213]
```

```chart
kind: funnel
title: From visit to paid
tone: c1
data:
  - [Visited the site, 48200]
  - [Created an account, 8700]
  - [Started a trial, 4100]
  - [Paid, 1350]
steps:
  - title: Last quarter.
  - title: After the shorter sign-up form.
    data:
      - [Visited the site, 49500]
      - [Created an account, 11300]
      - [Started a trial, 5200]
      - [Paid, 1720]
```

```chart
kind: waterfall
title: Monthly revenue bridge
x: { label: driver, values: [October, New, Churn, Refunds, Subtotal, Price rise, November] }
y: { label: revenue, format: money, currency: EUR }
data: [84000, 12500, -9100, -2300, "=", 4800, "="]
```

```chart
kind: treemap
title: Where the disk went
y: { label: disk use, format: bytes }
data:
  - name: Media
    children:
      - { name: Videos, value: 412000000000 }
      - { name: Photos, value: 186000000000 }
  - name: Code
    children:
      - { name: Repos, value: 86000000000 }
      - { name: Build cache, value: 88000000000 }
  - { name: Backups, value: 140000000000 }
```

```chart
kind: sunburst
title: Lines of code by team and area (thousands)
y: { label: lines of code }
data:
  - name: Platform
    children:
      - { name: Runtime, value: 93 }
      - { name: Storage, value: 66 }
  - name: Product
    children:
      - { name: Web, value: 95 }
      - { name: Mobile, value: 69 }
  - { name: Docs, value: 18 }
```

```chart
kind: calendar
title: Commits, September to November
y: { label: commits }
tone: good
from: 2026-09-01
to: 2026-11-30
data: [["2026-09-01", 7], ["2026-09-02", 6], ["2026-09-03", 5], ["2026-09-07", 4], ["2026-09-09", 2], ["2026-09-12", 2], ["2026-09-14", 4], ["2026-09-15", 10], ["2026-09-16", 1], ["2026-09-17", 3], ["2026-09-18", 5], ["2026-09-21", 8], ["2026-09-23", 9], ["2026-09-24", 5], ["2026-09-25", 3], ["2026-09-26", 2], ["2026-09-27", 1], ["2026-09-28", 9], ["2026-09-29", 8], ["2026-09-30", 7], ["2026-10-01", 8], ["2026-10-02", 9], ["2026-10-04", 1], ["2026-10-05", 5], ["2026-10-06", 9], ["2026-10-11", 2], ["2026-10-12", 9], ["2026-10-13", 9], ["2026-10-15", 5], ["2026-10-16", 6], ["2026-10-17", 1], ["2026-10-18", 1], ["2026-10-20", 8], ["2026-10-21", 3], ["2026-10-22", 6], ["2026-10-23", 6], ["2026-10-24", 1], ["2026-10-25", 1], ["2026-10-26", 2], ["2026-10-29", 7], ["2026-10-30", 7], ["2026-10-31", 1], ["2026-11-01", 0], ["2026-11-04", 4], ["2026-11-06", 5], ["2026-11-07", 0], ["2026-11-08", 0], ["2026-11-09", 2], ["2026-11-11", 2], ["2026-11-12", 6], ["2026-11-13", 8], ["2026-11-14", 2], ["2026-11-15", 0], ["2026-11-16", 8], ["2026-11-17", 6], ["2026-11-18", 3], ["2026-11-19", 1], ["2026-11-21", 2], ["2026-11-22", 2], ["2026-11-23", 3], ["2026-11-24", 8], ["2026-11-26", 7], ["2026-11-27", 10], ["2026-11-28", 0], ["2026-11-29", 1], ["2026-11-30", 7]]
```

Each kind takes `title`, `tone` where it makes sense, `y: { label, format, currency }` for the value axis (the histogram's is `x`), and `steps:` that change `data`, `marks` or `bins` from one step to the next.

## Compare

**A comparison matrix puts options side by side, one line for each thing you judge them on.** The first line names the options; every other line is a criterion and one value for each option, in the same order. A note in round brackets shows when a reader hovers, focuses or taps the value. With `winner=on` the best value of each yes/no, scored or good/bad row is marked; `pick=` flags the option you recommend.

```compare title="Which queue?" winner=on pick=Kafka
options: Redis Streams [c1], Kafka [c2], SQS [c3]
Ordering: yes, yes, partial (FIFO queues only)
Runs itself: no, no, yes
Throughput: 3, 5, 3 (score 1-5)
Latency (lower is better): 4 ms (in one region), 12 ms, 25 ms
Replay old messages: yes (until trimmed), yes (by offset), no
Cost at our size: good, bad, good (pay per request)
Team knows it: yes, partial (two people), yes
```

With `view=single`, a phone shows one option at a time, chosen from buttons. Here the values are plain words and good, warn and bad, so no row is marked as the best.

```compare title="Where to host the docs" view=single
options: Own servers, Static host, Wiki service
Set-up time: a week, an hour, a day
Custom domain: good, good, warn (paid plan only)
Search: warn (add one), warn (add one), good
Who can edit: developers, developers, anyone with an account
```

## Compare image

**A before-and-after picture lays two images of the same size on top of each other, with a bar between them.** Drag the bar (or anywhere on the picture), press the arrow keys, or tap the picture to flip from one to the other; the two labels jump to a whole image. Each image line gives the address and the alt text in quotes, which is what a screen reader and an LLM read. The address goes through the host's URL policy (a relative path, http or https; never `data:`). The two sample images are the files `before-light.svg` and `after-dark.svg` in this part's `media/` folder: a host serves that folder as `media/`.

```compare-image title="A dashboard, light and dark" before="Light" after="Dark"
before: media/before-light.svg "A dashboard with four tiles and a bar chart on a light page"
after: media/after-dark.svg "The same dashboard on a dark page"
```

## Diff

A `diff` block holds what `git diff` prints. It is drawn as a diff view: a file header with how much changed, line numbers on both sides, the changed words marked inside a changed line, and long unchanged runs folded. It is split on a wide part and unified on a narrow one; the buttons switch it, and `view=split` or `view=unified` fixes it. On a phone the lines do not wrap: the numbers and the sign stay in view while the code scrolls inside its box.

```diff
diff --git a/src/server.ts b/src/server.ts
index 4b825dc..9f3c1a7 100644
--- a/src/server.ts
+++ b/src/server.ts
@@ -12,9 +12,10 @@ export function start(config: Config) {
   const port = config.port ?? 8080;
-  const host = "localhost";
+  const host = config.host ?? "0.0.0.0";
   const server = createServer(handler);
-  server.listen(port, host);
+  server.listen(port, host, () => log.info("listening", { port, host }));
   register(server);
   watch(config);
   return server;
@@ -48,6 +49,6 @@ export function stop(server: Server) {
   unwatch();
-  server.close();
+  server.close(() => log.info("closed"));
 }
@@ -80,18 +81,19 @@ export function reload(server: Server) {
   const next = readConfig();
-  if (next.port !== current.port) restart(server);
+  if (next.port !== current.port || next.host !== current.host) restart(server);
   current = next;
   emit("reload", next);
   mark("reload");
   audit(next);
   notify(next);
   flush();
   settle();
   prune();
   index();
   compact();
   verify();
+  log.debug("reloaded", { port: next.port });
   return server;
 }
```

With `static` the diff is drawn whole, with no button: every file open, and a folded run only says how many lines it holds.

```diff static
--- a/src/greet.ts
+++ b/src/greet.ts
@@ -1,4 +1,4 @@
 export function greet(name: string) {
-  return "Hello, " + name;
+  return `Hello, ${name}!`;
 }
```

## Downloads

A card for each file: a type icon, its size, a plain download link, and a checksum that copies on a tap, with the line that checks it. Nothing is counted and nothing is fetched until the reader presses Download.

```downloads title="Files for this page"
media/report.pdf "The report, first pages" 209 KB sha256=d14bdfa9e9a37c960e8a2835fd6c0e75aa6e201e1e967d18159378e3de124372
media/talk.mp3 "The spoken sample" 229 KB sha256=8ed40d5dc963c74c457b987f9af4b4f3a33f1c13aa7a547cd3e959bf6fcd5d55
media/build.json "The hand-written animation" 6.4 KB note="A Lottie file with no expressions and no images."
https://example.com/durian-markdown-0.7.0.tar.gz "Source archive (an example address)" 1.2 MB sha256=2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae note="The address is an example; nothing is fetched until you press Download."
media/requests.csv "Raw data" 15.4 KB note="One row per request."
```

## Explore

A fence in the data's own language, followed by `explore`, becomes a foldable tree with a search box, a copy-path button on every key and a **jq subset** query box. It reads JSON, YAML or CSV (a CSV's rows become objects). `query=` is the starting query. The box runs our own small jq (the "jq subset": paths, pipes, `select`, `map`, `keys`, `length`, `sort_by`, `group_by`, `to_entries`, `test`, string interpolation, building objects and arrays); a query that needs more work than a page may use says so, and a function outside the subset is named, never answered wrongly. It lacks assignment (`|=`), `reduce`, `foreach`, `def`, `paths`, `del`, `sub`, `gsub`, `match` and `walk`.

```json explore title="One order" query=".lines[] | select(.qty > 1)"
{
  "id": "o-7",
  "customer": { "id": "c-12", "name": "Ana", "tags": ["vip", "early"] },
  "lines": [
    { "sku": "tea", "qty": 2, "price": 3.5 },
    { "sku": "cup", "qty": 1, "price": 8 },
    { "sku": "pot", "qty": 3, "price": 12.25 }
  ],
  "paid": true,
  "note": null
}
```

The same reader takes YAML and CSV. TOML exploration is refused until a TOML reader is available; the TOML example below is ordinary code:

```yaml explore title="A service config" query=".limits | map_values(ascii_upcase)"
service: shop
replicas: 3
limits:
  cpu: 500m
  mem: 256Mi
hosts:
  - name: app-1.example.com
    zone: a
  - name: app-2.example.com
    zone: b
```

```toml
[server]
host = "198.51.100.7"
port = 8443
tls = true

[limits]
cpu = "500m"
```

```csv explore title="Latency by region" query="sort_by(.p95) | reverse | .[0].region"
region,p50,p95,requests
us-west,42,120,1200000
eu-central,55,180,830000
ap-south,70,260,410000
```

## Fishbone

Causes by category along a spine into the effect. In a narrow column the spine turns vertical.

```fishbone title="Why is checkout slow?"
effect: Checkout takes 4 seconds at p95
People: on-call is new to the service
Process: no load test before a release
  only staging has real data
Tools: the ORM loads every line item
  one query per line
Environment: the database is in another region
```

With steps, the bones come in one at a time, and `highlight` lights one.

```fishbone title="Why did the deploy fail?"
effect: The deploy rolled back
@step The first two causes.
Config: a key was renamed in one place only
Tests: the contract test was skipped
@step The third, and the one to fix first.
Release: two services shipped in the wrong order
highlight Config
```

## Flame chart and flame graph

A traced request and folded profiler stacks. Tap a frame to zoom; search highlights matching frames.

```flame title="One request, traced" unit=ms
0 120 request
  2 14 auth.check
  15 95 handler.order
    16 70 db.query
    72 90 render.page
  96 118 respond.write
```

```flame title="CPU, 30 seconds" unit=samples colour=heat
main;serve;handle;parse 120
main;serve;handle;db.query 300
main;serve;handle;db.query;lock.wait 80
main;serve;handle;render.page 95
main;serve;gc 45
main;serve;accept 30
main;housekeeping;flush 60
```

## Gallery

A carousel shows one image at a time: swipe, use the arrow keys, the buttons or the dots. A tap opens the picture full screen, where pinch, wheel and double tap zoom it, and one finger or the mouse pans.

```gallery title="Four sample pictures" view=carousel loop
![A harbour at dawn: a low sun over a still sea](media/harbour.svg "Harbour at dawn: a made-up picture for the sample")
![A pine forest in green light](media/forest.svg "Pine forest")
![Sand dunes under a pale sky](media/dunes.svg "Dunes at noon")
![A mountain behind a lake](media/lake.svg "Mountain lake")
```

A grid crops to a ratio (the full picture stays in the lightbox), with the caption under each image.

```gallery title="The same pictures, as a grid" view=grid columns=3 ratio=4:3
![A harbour at dawn](media/harbour.svg "Harbour")
![A pine forest](media/forest.svg "Forest")
![Sand dunes](media/dunes.svg "Dunes")
![A mountain lake](media/lake.svg "Lake")
```

One image, with zoom.

```gallery view=single
![A mountain behind a lake](media/lake.svg "Tap the picture to see it full screen")
```

## Gantt

A task line is `<id> "label" <start> <end or length> [progress%] [done] [colour]`; a start is a date or `after <id> ...`; `milestone` is a point; `section` groups the lines after it. `today=` draws a line (never the real clock). Hover, tap or focus a bar for its dates and what it waits for; Day, Week and Month change the scale.

```gantt title="Release 2.0" today=2026-12-09
section Build
design "Design" 2026-12-01 .. 2026-12-04 done
api "API" after design 8d 60%
ui "Screens" after design 6d
section Ship
beta "Beta" after api ui 3d [warn]
launch "Launch" milestone after beta
```

Under steps, `progress`, `done` and `move` change the plan as time passes; a slip carries the tasks after it. `workdays=on` makes lengths skip Saturday and Sunday, and `critical=on` outlines the longest chain.

```gantt title="A release that slips" workdays=on critical=on today=2026-12-14
section Build
design "Design" 2026-12-01 .. 2026-12-04 done
api "API" after design 8d 40%
ui "Screens" after design 6d
section Test
qa "QA" after api ui 5d
@step The plan on 1 December
@step Design is done, the API is under way
progress api 60%
progress ui 100%
@step The API slips by a week
move api 2026-12-14
launch "Launch" milestone after qa
```

## Glossary

Terms defined once. Where a term is used in the text, its first use in each section is a button with a dotted underline: hover it, tap it, or focus it and press Enter to read the meaning.

```glossary title="Words we use"
term "UL" also "ubiquitous language": the words a team agrees on and uses in code and in talk
term bc "bounded context" also "context map": one part of the system with its own **words**; see [the book](https://example.com/ddd)
```

Each team keeps its own UL inside a bounded context. The second use of UL in the same section stays plain text: UL.

## Graph

A graph is for finding your way around a big network: what uses what, and what breaks if one part goes. Write `group` and `node` lines, then one edge a line (`a -> b`, with a label in quotes if it needs one). A node an edge names and no line declares is added (here the outside libraries). `layout=layers` puts each package above what it uses. **Explore it:** search a package, tap one to focus it and its neighbours (1 or 2 steps out), fold a group into one box, pan and zoom; the list beside the graph shows its links in and out. A graph this size reads as over 400 tokens, so the `:::llm` after it says the same in short.

```graph title="A shop's packages, and what each one uses" layout=layers
group apps "apps" [c1]
group ui "user interface" [c4]
group domain "domain" [c2]
group data "data access" [c6]
group core "core" [c3]
group tools "build and test" [muted]
node web "web shop" in apps
node admin "admin console" in apps
node worker "background worker" in apps
node cli "command line" in apps
node ui-kit, charts, forms, icons, theme in ui
node cart, checkout, catalog, accounts, search, pricing, orders, money, auth in domain
node db, cache, queue, events, http-client, storage in data
node config, log, errors, util, i18n, time in core
node build, lint, test-kit in tools
web -> ui-kit, forms, cart, checkout, catalog, search, accounts, i18n
admin -> ui-kit, charts, forms, orders, catalog, accounts
worker -> orders, events, queue, log
cli -> config, catalog, db
ui-kit -> theme, icons, react
charts -> ui-kit, chart.js "lazy"
forms -> ui-kit, zod
cart -> pricing, catalog, cache
checkout -> cart, orders, money, auth
catalog -> db, search, storage
accounts -> auth, db, events
search -> http-client, cache
pricing -> money, catalog
orders -> db, money, events, queue
money -> util
auth -> db, cache, errors
db -> pg, config, log, errors
cache -> ioredis, config
queue -> ioredis, events
events -> log, time
http-client -> undici, errors
storage -> http-client, config
config -> zod, util
log -> time, util
errors -> util
i18n -> date-fns, util
time -> date-fns
test-kit -> db, cache, config "fakes"
build, lint -> config
```

:::llm
A layered package graph of a shop: 33 packages in 6 groups, plus 7 outside libraries (react, chart.js, zod, pg, ioredis, undici, date-fns); 80 edges. The apps (web shop, admin console, background worker, command line) use the user interface packages (ui-kit, charts, forms, icons, theme) and the domain packages (cart, checkout, catalog, accounts, search, pricing, orders, money, auth). The domain uses data access (db, cache, queue, events, http-client, storage), which uses core (config, log, errors, util, i18n, time). Checkout needs cart, orders, money and auth; auth needs db, cache and errors. Most connected: db (6 in, 4 out), config (7 in, 2 out), web (8 out), catalog (5 in, 3 out).
:::

`layout=force` pulls linked services together and pushes the rest apart, so the clusters show. It fits calls between services, where there is no top or bottom. An id may carry a numbered range: `node db-orders-{1..6} in data` declares six shards, and `orders -> db-orders-{1..6}` draws a line to each. **Fold a group** (beside the graph, or a double tap on its box) and its lines join on one box with a count; **Fold groups** folds them all. A graph over 300 nodes, or one that would be drawn too small to touch in its box (a phone), starts with every group folded. Its LLM view is the nodes by group, the edges as `a -> b` lines, and the most connected nodes: here far over 400 tokens, so a `:::llm` says it in short.

```graph title="Calls between the services of a shop" layout=force size=l
group edge "edge" [c1]
group identity "identity" [c2]
group catalog "catalog" [c3]
group orders "orders" [c4]
group payments "payments" [c5]
group fulfil "fulfilment" [c6]
group data "data stores" [c8]
group platform "platform" [c7]
node cdn, waf, gateway, web-bff, mobile-bff, admin-bff, graphql, rate-limit, bot-check, geo-route, edge-cache, ws-hub, upload-proxy, img-proxy, status-page in edge
node auth, sessions, users, profiles, roles, mfa, sso, tokens, consent, audit, password-reset, email-verify, devices, risk-score, api-keys in identity
node catalog-api, products, variants, inventory, prices, promos, reviews, search-api, indexer, recs, media, categories, brands, bundles, wishlist in catalog
node cart-api, checkout, orders-api, order-events, invoices, returns, refunds, tax, shipping-quote, gift-cards, loyalty, quotes, subscriptions, order-history, fraud in orders
node pay-api, card-vault, psp-a, psp-b, wallets, payouts, ledger, fx, disputes, settlements, pay-events, three-ds, chargebacks, billing, receipts in payments
node fulfil-api, warehouses, picking, packing, carriers, labels, tracking, dispatch, slots, couriers, stock-sync, returns-in, notify, sms, email in fulfil
node db-orders-{1..6}, db-users, db-catalog, cache-{1..3}, search-index, blob-store, event-bus, dw in data
node config-svc, flags, secrets, metrics, logs, traces, scheduler, jobs, alerts, ci, registry, mesh, dns, kms, backups in platform
cdn -> edge-cache, img-proxy, waf
waf -> gateway, bot-check, rate-limit
gateway -> web-bff, mobile-bff, admin-bff, graphql, ws-hub, upload-proxy, geo-route
web-bff -> auth, sessions, catalog-api, cart-api, search-api, recs, checkout
mobile-bff -> auth, sessions, catalog-api, cart-api, search-api, wishlist, checkout
admin-bff -> auth, roles, catalog-api, orders-api, refunds, users, audit
graphql -> catalog-api, orders-api, profiles, reviews
ws-hub -> tracking, order-events, sessions
upload-proxy -> media, blob-store
img-proxy -> media
status-page -> metrics, alerts
auth -> sessions, users, mfa, sso, tokens, risk-score, devices
sessions -> cache-1, tokens
users -> db-users, profiles, email-verify, audit
profiles -> db-users, media, consent
roles -> db-users, audit
mfa -> sms, email, devices
sso -> tokens, users
tokens -> kms, cache-1
password-reset -> email, tokens, users
email-verify -> email
api-keys -> tokens, db-users
risk-score -> devices, fraud
catalog-api -> products, categories, brands, prices, inventory, media, bundles
products -> variants, db-catalog, cache-2
variants -> db-catalog
inventory -> db-catalog, stock-sync, event-bus
prices -> promos, fx, cache-2
promos -> db-catalog
reviews -> db-catalog, users
search-api -> search-index, recs
indexer -> search-index, event-bus, products
recs -> dw, cache-2
wishlist -> db-users, products
cart-api -> products, prices, promos, cache-3, gift-cards
checkout -> cart-api, tax, shipping-quote, pay-api, orders-api, fraud, loyalty
orders-api -> db-orders-{1..6}, order-events, invoices
order-events -> event-bus
invoices -> tax, receipts, blob-store
returns -> orders-api, returns-in, refunds
refunds -> pay-api, ledger
tax -> fx
shipping-quote -> carriers, slots
gift-cards -> ledger
loyalty -> users, ledger
quotes -> prices, tax
subscriptions -> billing, orders-api, scheduler
order-history -> db-orders-{1..6}, dw
fraud -> risk-score, dw
pay-api -> card-vault, psp-a, psp-b, wallets, three-ds, ledger, pay-events
card-vault -> kms, secrets
psp-a, psp-b -> pay-events
wallets -> ledger
payouts -> ledger, psp-a, settlements
ledger -> fx, dw
disputes -> chargebacks, psp-a, psp-b
settlements -> ledger, dw
pay-events -> event-bus
chargebacks -> ledger
billing -> pay-api, receipts
receipts -> email, blob-store
fulfil-api -> warehouses, dispatch, labels, tracking
warehouses -> stock-sync, picking
picking -> packing
packing -> labels
labels -> carriers, blob-store
carriers -> tracking
tracking -> notify, event-bus
dispatch -> couriers, slots, carriers
stock-sync -> inventory, event-bus
returns-in -> warehouses, refunds
notify -> sms, email
event-bus -> fulfil-api, indexer, notify, dw, audit
scheduler -> jobs
jobs -> backups, indexer, payouts, settlements
alerts -> metrics, logs
mesh -> dns, traces, metrics
backups -> blob-store
ci -> registry
config-svc -> flags, secrets
secrets -> kms
gateway, auth, checkout, pay-api, orders-api -> mesh
```

:::llm
A force-laid call graph of a shop: 120 services in 8 groups, 232 calls. Edge (cdn, waf, gateway, three backends for web, mobile and admin, graphql, ws-hub ...) calls identity (auth, sessions, users, tokens, mfa, sso ...) and catalog (catalog-api, products, prices, search-api, recs ...). Checkout calls cart-api, tax, shipping-quote, fraud, loyalty, pay-api and orders-api; orders-api writes six shards, db-orders-1 to db-orders-6. pay-api calls card-vault, two payment providers, wallets, three-ds and the ledger. Events go through event-bus to fulfilment (warehouses, picking, packing, labels, carriers, tracking), the indexer, notify, the warehouse (dw) and audit. Platform: config, flags, secrets, kms, metrics, logs, traces, the mesh, scheduler and jobs. Most connected: orders-api (5 in, 9 out), auth, catalog-api, pay-api, event-bus (6 in, 5 out).
:::

`layout=radial centre=<node>` puts one node in the middle and each ring one step further away, in either direction: what it uses and what uses it. Use it to answer "what touches this?". A small graph needs no `:::llm`: its LLM view is the graph itself, as lines.

```graph title="What touches the sign-in service" layout=radial centre=auth
group callers "calls sign-in" [c1]
group needs "sign-in calls" [c6]
node web, mobile, admin, cli in callers
node sessions, users, mfa, tokens in needs
node auth "sign-in"
web, mobile, admin, cli -> auth
auth -> sessions, users, mfa, tokens
mfa -> sms "codes"
tokens -> kms "signing keys"
sessions, users -> postgres
```

`static` draws the part still: the groups with how many nodes each holds, and a line that counts the edges between two groups. It is for print, a PDF, an email, or a reader who asks for less motion.

```graph title="The same sign-in graph, drawn still" layout=radial centre=auth static
group callers "calls sign-in" [c1]
group needs "sign-in calls" [c6]
node web, mobile, admin, cli in callers
node sessions, users, mfa, tokens in needs
node auth "sign-in"
web, mobile, admin, cli -> auth
auth -> sessions, users, mfa, tokens
mfa -> sms "codes"
tokens -> kms "signing keys"
sessions, users -> postgres
```

## Http

An `http` block is a request and, after a blank line, its response, as text. It is drawn as a method tag and the address (the query split into names and values), the headers (folded after six), the body (JSON is pretty and can be folded), the status as a tag coloured by its class, and a button that copies the request as `curl`. A secret in a header is never written out: use a placeholder such as `<token>`.

```http title="Create an order"
POST /v1/orders?dry_run=false&currency=usd HTTP/1.1
Host: api.example.com
Content-Type: application/json
Accept: application/json
Authorization: Bearer <token>
Idempotency-Key: 6f1c2d0e
User-Agent: shop-cli/2.4
X-Request-Id: req-7a91

{ "sku": "tea", "qty": 2, "ship": { "to": "198.51.100.7", "express": true }, "notes": ["gift", "no receipt"] }

HTTP/1.1 201 Created
Content-Type: application/json
Location: /v1/orders/o-7

{ "id": "o-7", "status": "open", "total": { "amount": 1840, "currency": "usd" } }
```

With `static` the whole message is drawn: every header, the whole JSON tree, no button.

```http static
HTTP/1.1 404 Not Found
Content-Type: application/json
Cache-Control: no-store

{ "error": "not_found", "detail": { "resource": "order", "id": "o-9" } }
```

## Log

A fence named `log`. It reads JSON lines, logfmt and the common "time level message key=value" shape. The filter box speaks **LogQL** (Grafana Loki's query language): `{level="error"}`, `|= "timeout"`, `!= "health"`, `|~ "5\\d\\d"`, `| status >= 500`; a box that starts with neither `{` nor `|` is plain words. Only the query half of LogQL is read, never metric queries. `filter=` is the starting filter. The author (often an agent) points at what matters with `@highlight` lines: a LogQL filter or `line 3-5`, a colour word and the reason in quotes.

```log title="The failed deploy" labels="app=shop, env=prod" filter="{level=~\"warn|error\"}"
2026-11-20T10:08:01Z info  deploy started version=1.4
2026-11-20T10:08:12Z info  migration applied name=0042
2026-11-20T10:09:03Z warn  cache miss rate high rate=0.41
2026-11-20T10:09:05Z error request failed path=/cart status=500 err="timeout after 30s" span=checkout trace=request
2026-11-20T10:09:06Z error request failed path=/cart status=500 err="timeout after 30s" span=checkout trace=request
@highlight |= "timeout" [bad] "every failure is the same timeout"
@highlight line 3 [warn] "the first sign"
```

## Lottie

A Lottie file is a drawing that moves. This one was written by hand for the sample: a box fills with blocks, one row at a time, then a tick appears. It plays while it is on screen, stops off it, and shows one still frame when the reader asks for less motion. The `colours:` line maps names inside the file to theme colours, so it follows light and dark.

```lottie src="media/build.json" title="What happens while it builds" loop
alt: A box fills with blocks, one row at a time, then a tick appears.
colours: dh-c1 = c1, dh-c2 = c2, dh-c3 = c3, dh-good = good
```

## Map and routes

Places and written routes work without a tile provider. A dashed route has no road geometry; the host may supply its own router.

```map title="Walk to the garden"
place start "Library" 51.507, -0.128 [c1] note="Meet by the entrance"
place garden "Garden" 51.511, -0.117 [c2]
route walk "Morning walk" by=walk [c2]: start -> 51.508, -0.123 -> garden
@step Meet at the library.
focus start
@step Follow the written route.
show walk
focus walk
```

Country values, US states and flows share the same map and value list.

```map title="Daily flow" unit="units per day" scale=steps steps=4
fill DE 83.2
fill FR 68.4
fill US-CA 39.5
arc DE -> FR 24 "Daily flow" [c2]
```

The globe uses the same data; with no WebGL it falls back to the flat map.

```map title="Global flow" view=globe spin=off unit="units per day"
fill DE 83.2
fill FR 68.4
arc DE -> FR 24 "Daily flow" [c2]
```

A static globe is a flat map with all its values, ready to print.

```map title="A still map" view=globe static
fill DE 83.2
fill FR 68.4
```

## Maths (`$...$`, `$$...$$` and `math`)

The area of a circle is $A = \pi r^2$, and a sum of the first $n$ numbers is:

$$
\sum_{k=1}^{n} k = \frac{n(n+1)}{2}
$$

The same in a `math` block, with a fraction, a root and a matrix:

```math
x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a} \qquad
\begin{pmatrix} 1 & 0 \\ 0 & 1 \end{pmatrix}
```

Prices stay text: it costs $5 and $10, and `$not maths$` in code is left alone.

## PDF

pdf.js draws the pages on a canvas, and its text layer makes the words selectable and searchable. The file below was printed from a small made-up document. The viewer works a page at a time; try the search box, the outline and the zoom.

```pdf src="media/sample.pdf" title="A sample document" page=1 height=l
```

`view=scroll` lays every page out in one scrolling column and draws the ones near the window.

```pdf src="media/sample.pdf" title="The same file, scrolling" view=scroll height=s
```

## Citations (`[@key]` and `references`)

A mark in the text opens its entry: marks make a study easier to read [@smith2020, p. 12], and two together are one group [@smith2020; @lee2019]. Hover, focus or tap a mark for the entry.

```references style=apa title="References"
- id: smith2020
  author: Smith, Jane; Lee, Kim
  title: A study of marks
  in: Journal of Studies
  year: 2020
  volume: 12
  issue: 3
  pages: 10-20
  doi: 10.1234/jbs.2020.4
- id: lee2019
  author: Lee, Kim
  title: Notes on lists
  type: web
  publisher: Example Press
  year: 2019
  url: https://example.com/notes
  accessed: 2026-11-20
```

## Sankey

A flow a line, `from -> to: amount`; `node <id> "label" [colour]` only to name or colour one. Hover, tap or focus a band to light its path and read its share.

```sankey title="Where a request's time goes" unit=ms
request -> auth: 12
request -> handler: 80
handler -> db: 55
handler -> render: 20
handler -> cache: 5
node db "Postgres" [c3]
node cache "Redis" [c2]
```

Flows under a step appear in it: the bands grow out of their source. In a narrow column, a sankey with more than three columns runs top to bottom.

```sankey title="Where the month's budget goes" unit=USD
income -> payroll: 62000
income -> infra: 21000
income -> tools: 6000
income -> reserve: 11000
@step The money in and the big three
@step Infrastructure breaks down
infra -> compute: 12500
infra -> storage: 5200
infra -> network: 3300
@step Compute splits by team
compute -> web: 7000
compute -> data: 4100
compute -> ml: 1400
node income "Revenue" [c1]
node payroll "People" [c4]
node infra "Infrastructure" [c6]
```

## Sequence

Who calls whom, in order. A call is a solid arrow, a reply a dashed one; a block (`loop`, `alt`, `opt`, `par`) frames the messages inside it. An LLM reads the messages as a numbered list.

```sequence title="One init call"
actor dev "developer"
participant cli "CLI"
participant tc "template container"
dev -> cli: scaffold create
cli -> tc: init call, all answers
tc --> cli: question reply
note tc: the script stopped at a question
loop until no question is left
  cli -> tc: init call, one more answer
  tc --> cli: question reply
end
cli --> dev: project written
```

With `@step` lines the story builds up one call a step: the earlier calls fade and the new one draws itself.

```sequence
participant cli "CLI"
participant tc "template container"
@step The CLI sends an init call with every answer it holds.
cli -> tc: init call: all answers
@step The script stops at a question and sends it back.
tc --> cli: question reply
@step The next init call carries one answer more.
cli -> tc: init call: one more answer
```

## Sparkline in a sentence (`:spark[...]`)

`:spark[3,5,2,8,9]` draws a tiny line the height of the text. Add `bar` for bars and a colour word for the colour: `:spark[3,5,2,8,9 bar good]`. Hover, tap or focus it to see the numbers. A model reads `(3, 5, 2, 8, 9)`.

Sign-ups this week were :spark[120,135,128,160,182,171,205] and rising, errors fell to :spark[14,12,15,9,7,4,3 bar good], and the queue is :spark[5,4,6,22,31,18,9 warn] after Wednesday's spike.

## Stacktrace

A fence named `stacktrace`. It reads a trace as printed by Go, .NET, Bun or Node, Dart, Java or Python: the error line, each cause in its own block, threads as groups. Library frames fold into one bar; frames of your own code (`app=`) are marked, and with `repo=` and `strip=` they name the file and line at the page’s pinned commit (when its front matter has a matching pins entry). Tap a frame to open it.

```stacktrace lang=go app=example.com/shop repo=example.com/shop strip=/src/shop/ title="A Go panic"
panic: runtime error: index out of range [3] with length 3

goroutine 18 [running]:
example.com/shop/cart.(*Cart).Item(...)
	/src/shop/cart/cart.go:42
example.com/shop/api.(*Server).getItem(0xc0001a2000, {0x7f1c, 0xc000124000}, 0xc000188000)
	/src/shop/api/items.go:88 +0x1d4
net/http.HandlerFunc.ServeHTTP(0xc000010040, {0x7f1c, 0xc000124000}, 0xc000188000)
	/usr/local/go/src/net/http/server.go:2136 +0x29
net/http.serverHandler.ServeHTTP({0xc00011e000}, {0x7f1c, 0xc000124000}, 0xc000188000)
	/usr/local/go/src/net/http/server.go:2938 +0x8e
```

## Stack traces in the other five languages

`lang=` may be left out when the trace says it. Each trace below is read by its own parser.

```stacktrace app=Acme.Shop title=".NET, with an inner exception"
System.InvalidOperationException: Cart failed
 ---> System.ArgumentException: Index out of range (Parameter 'i')
   at Acme.Shop.Cart.Item(Int32 i) in /src/shop/Cart.cs:line 42
   at System.Linq.Enumerable.First[TSource](IEnumerable`1 source)
   --- End of inner exception stack trace ---
   at Acme.Shop.Api.GetItem(Int32 id) in /src/shop/Api.cs:line 88
   at Microsoft.AspNetCore.Mvc.Invoke()
```

```stacktrace app=/src/shop title="Bun or Node, with a cause"
Error: request failed
    at fetchItem (file:///src/shop/api.ts:42:11)
    at async handler (/src/shop/server.ts:10:3)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at run (/src/shop/node_modules/lib/index.js:5:9)
Caused by: TypeError: bad json
    at parse (/src/shop/util.ts:7:2)
```

```stacktrace app=shop title="Dart, with an async gap"
Unhandled exception:
Bad state: no element
#0      Cart.item (package:shop/cart.dart:42:7)
#1      Api.get (package:shop/api.dart:10:3)
<asynchronous suspension>
#2      _rootRunUnary (dart:async/zone.dart:1407:47)
#3      State.setState (package:flutter/src/widgets/framework.dart:1100:9)
```

```stacktrace app=com.acme.shop title="Java, with Caused by"
java.lang.IllegalStateException: cart failed
	at com.acme.shop.Cart.item(Cart.java:42)
	at com.acme.shop.Api.get(Api.java:88)
	at java.base/java.util.ArrayList.get(ArrayList.java:427)
	... 12 more
Caused by: java.io.IOException: boom
	at com.acme.shop.Db.read(Db.java:7)
	... 5 common frames omitted
```

```stacktrace app=/src/app title="Python, chained"
Traceback (most recent call last):
  File "/src/app/db.py", line 5, in read
    raise OSError("boom")
OSError: boom

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/src/app/main.py", line 10, in <module>
    run()
  File "/usr/lib/python3.11/site-packages/x.py", line 5, in run
    raise ValueError("bad")
ValueError: bad
```

## Stats

**Stat tiles are the row of big numbers at the top of a dashboard:** each tile is one figure with its name, how it changed and, if given, a tiny line of its recent values, so a reader takes in the state of something at a glance before reading on. The colour word in brackets says whether the change is good or bad (a fall in latency is good); it is never guessed from the sign.

```stats title="The week"
Requests "1.2 M" change=+12% [good] note="last 7 days" spark=3 5 4 6 8 9
p95 latency "180 ms" change=-8% [good] spark=9 8 8 7 7 6 5
Errors "0.4%" change=+0.1 [bad] note="of requests" spark=2 2 3 2 4 5
Cost "USD 412" change=+3% spark=4 4 5 5 5 6
```

A tile can also carry a glyph, a trend word and a sub-line. This block is `static`: it draws the tiles whole, the same in print.

```stats title="Garden at a glance" static
Yield "251 kg" glyph="✦" trend=up sub="Across three plots" change=+8% [good] note="this season" spark=180 192 205 224 251
Water "120 L" glyph="◉" trend=down sub="Stored rainwater" change=-6% [good] note="this week" spark=150 145 138 126 120
Beds "30" glyph="▦" trend=flat sub="Ready for planting" [c3]
```

## Timeline

One line per event, oldest first; an indented line is a detail. A year, a month or a day.

```timeline title="A release plan"
2026-05-04 Design review [c1]
  Scope and owners agreed
2026-09 First release [c2]
2026-11-21 Old drawing code removed [c5]
  New drawn parts take their place
2026-11-23 Version 2 ships [good] note="the big one"
```

With `dir=across` a wide screen lays it out sideways; a phone is always top to bottom. With steps, the events come in one group at a time.

```timeline title="A build-up" dir=across
2026 The idea
@step The first half of the year.
2026-03 A prototype
2026-06 A first user
@step The second half.
2026-09 First release [c2]
2026-12 Version 2 [good]
```

## Trace waterfall

A request across services. Fold spans, search, zoom the mini map, or switch to Flame.

```trace title="POST /checkout" unit=ms trace=t-7f3a
web        POST /checkout        0 842  user=u7 region=us-west-2
  gateway  route /checkout       3 838  route=checkout
    auth   verify.token          6  44  method=jwt
      db   SELECT sessions      10  38  rows=1
    cart   cart.load            47 205  items=3
      db   SELECT cart_items    52 121  rows=3
      db   SELECT prices       126 198  rows=3 cache=miss
    inventory stock.reserve     50 171  warehouse=w2
      db   UPDATE stock         57 166  rows=1 id=stock-update
    payment charge.card        208 812  provider=examplepay error="payment provider timed out"
      payment tls.connect      212 255
      payment provider.call    258 804  attempt=1 id=provider error="upstream timeout after 540 ms"
    queue  publish.retry       814 834  topic=payments.retry id=retry
@log db 130 warn "row lock held 94 ms" span=stock-update
@log payment 258 info "calling examplepay /v2/charge"
@log payment 804 error "upstream timeout after 540 ms, giving up"
@log queue 820 info "queued a retry for order o-2291"
@log web 840 error "answered 504 to the client"
@service db [c5] "Postgres"
```

:::llm
One checkout request, 842 ms, across 8 services. The payment provider call (258–804 ms) timed out, so charge.card and the request failed with a 504, and a retry was queued. Stock was reserved in parallel with the cart load and is not on the critical path; UPDATE stock in db waited 94 ms on a row lock.
:::

```trace title="GET /health" unit=ms open=2
web   GET /health        0 9
  api health.check       1 8
    db SELECT 1          2 6
```

```trace title="A flat list" unit=ms critical=off
web   GET /orders     0 60   id=a
api   orders.list     3 55   id=b parent=a
db    SELECT orders   8 40   id=c parent=b rows=25
api   orders.render  41 54   id=d parent=b
```

## Venn

Two to four sets in fixed, even shapes. It is not drawn to scale on purpose: the names are written in the regions. Hover, tap or focus a region to read its items; on a narrow screen they are listed under the figure.

```venn title="Who writes what"
set go "Go" [c1]
set rust "Rust" [c2]
set zig "Zig" [c3]
go: Ana, Ben
go & rust: Cy
go & rust & zig: Dee (writes all three)
rust: Eve, Fay
zig: 4 people
```

With steps, one set comes in at a time, with its regions.

```venn title="Adding one set at a time"
set a "Readers" [c4]
set b "Writers" [c5]
set c "Reviewers" [c6]
@step Readers and writers overlap.
a: Ana, Ben
a & b: Cy
b: Dee
@step Reviewers join; some people do all three.
c: Eve
a & b & c: Fay
```

## Video

A video part keeps the browser's video and draws its own controls: a big play button on the poster, a bar with the chapters as segments (point at it to see the chapter and a still), captions drawn by us from a WebVTT file, picture in picture and full screen. The picture here is a made-up moving gradient.

```video src="media/sample.mp4" poster="media/poster.jpg" title="Colours drifting" duration=0:12
captions: media/sample.en.vtt "English" default
thumbs: media/thumbs.vtt
chapter 0:00 Warm
chapter 0:04 Cool
chapter 0:08 Bright
0:00 The colours drift slowly across the frame.
0:04 Captions are drawn by the part from a WebVTT file.
0:08 Press C to turn them off, and F for full screen.
```

`clip` is for a short screen recording that would otherwise be a GIF: it plays muted and in a loop while it is on screen, stops when it scrolls away, and stays still when the reader asks for less motion.

```video src="media/clip.mp4" title="A short silent loop" clip height=s
```

## Wardley map

Components by evolution (left to right) and visibility (top to bottom). Positions are named keys, so the two numbers cannot be swapped.

```wardley title="A tea shop"
anchor customer "Customer" visible=0.95 evolution=0.6
component cup "Cup of tea" visible=0.8 evolution=0.6
component tea "Tea" visible=0.6 evolution=0.8
component kettle "Kettle" visible=0.45 evolution=0.4
component power "Power" visible=0.1 evolution=0.85
customer -> cup
cup -> tea
cup -> kettle
kettle -> power
note "Kettles are a product now" visible=0.3 evolution=0.1
@step Today the kettle is a product we buy.
highlight kettle
@step A smart kettle moves it further to the right.
evolve kettle 0.65 "smart kettle"
```

## Weather

A forecast written in the source; it never fetches. The units menu on the part switches °C and °F, km/h, mph, m/s and knots, mm and inches, hPa and inHg, and your choice is remembered in this browser.

```weather place="San Francisco" unit=c tz=America/Los_Angeles
2026-11-22 sun 18/11 rain=0% wind=12km/h pressure=1021hPa
2026-11-23 partly 16/10 rain=10% wind=15km/h pressure=1018hPa
2026-11-24 rain 14/9 rain=80% wind=30km/h precip=6mm pressure=1004hPa
2026-11-25 storm 13/8 rain=95% wind=45km/h precip=14mm pressure=996hPa note="Ferry may stop"
2026-11-26 cloud 12/7 rain=30% wind=20km/h precip=1mm pressure=1009hPa
```

Hours work the same way, with one temperature, here written in °F and mph.

```weather place="Oakland" unit=f wind=mph tz=America/Los_Angeles
2026-11-24 06:00 fog 48 rain=5% wind=4mph
2026-11-24 09:00 cloud 52 rain=20% wind=8mph
2026-11-24 12:00 drizzle 57 rain=60% wind=11mph
2026-11-24 15:00 rain 59 rain=85% wind=14mph
2026-11-24 18:00 rain 55 rain=70% wind=12mph
2026-11-24 21:00 cloud 51 rain=25% wind=7mph
```

The same forecast with `static`: drawn whole in the fence's unit, with no menu.

```weather static place="Sydney" unit=c wind=kmh
2026-11-22 sun 24/17 rain=0% wind=14km/h
2026-11-23 partly 22/16 rain=20% wind=18km/h
2026-11-24 sleet 3/-1 rain=70% wind=22km/h note="Ice on the road"
```
````

Every public sample of the package on one page: 111 samples in four groups. Open "Source" under any sample to see what was written.

Text, blocks and parts

Fishbone — find the causes

Group possible causes around one effect, then reveal the next finding. Try the step controls, or compare the finished static drawing below. The theme buttons apply to both.

Checkout takes 4seconds at p95Toolsthe ORM loads everyline item· one query per lineProcessno load test beforea release
Checkout takes 4 seconds at p95Toolsthe ORM loadsevery line item· one query perlineProcessno load testbefore a release
1Start with the service
1 / 2

The same diagram, ready to print

Checkout takes 4seconds at p95Toolsthe ORM loads everyline item· one query per lineProcessno load test beforea releaseEnvironmentthe database is inanother regionPeopleon-call is new to theservice
Checkout takes 4 seconds at p95Toolsthe ORM loadsevery line item· one query perlineProcessno load testbefore a releaseEnvironmentthe database is inanother regionPeopleon-call is new tothe service
Source: `fixtures/format/00-fishbone.dh.md`
text
---
title: Fishbone — find the causes
---
# Fishbone — find the causes
Group possible causes around one effect, then reveal the next finding. Try the step controls, or compare the finished static drawing below. The theme buttons apply to both.
```fishbone title="Why is checkout slow?"
effect: Checkout takes 4 seconds at p95
@step Start with the service
Tools: the ORM loads every line item
one query per line
Process: no load test before a release
@step Check the surroundings
Environment: the database is in another region
People: on-call is new to the service
highlight Tools
```
## The same diagram, ready to print
```fishbone static title="Why is checkout slow?"
effect: Checkout takes 4 seconds at p95
Tools: the ORM loads every line item
one query per line
Process: no load test before a release
Environment: the database is in another region
People: on-call is new to the service
highlight Tools
```

Sankey — follow the flow

Follow a request's time through the service. Band widths show milliseconds; hover, focus or tap a band to read its share. Full labels stay on plates in either theme.

Where a request's time goes
1Enter the service
1 / 2

Hover or tap a flow or a node.

Show the numbers as a table
FromTomsShare
Incoming requestAuthentication1213%
Incoming requestApplication processing8087%

The same flow, ready to print

Where a request's time goes
Show the numbers as a table
FromTomsShare
Incoming requestAuthentication1213%
Incoming requestApplication processing8087%
Application processingDatabase queries5569%
Application processingResponse assembly2025%
Application processingCache lookup56%
Source: `fixtures/format/00-sankey.dh.md`
text
---
title: Sankey — follow the flow
---
# Sankey — follow the flow
Follow a request's time through the service. Band widths show milliseconds; hover, focus or tap a band to read its share. Full labels stay on plates in either theme.
```sankey title="Where a request's time goes" unit=ms
request -> auth: 12
request -> handler: 80
node request "Incoming request" [c1]
node auth "Authentication" [c2]
node handler "Application processing" [c3]
node db "Database queries" [c4]
node render "Response assembly" [c5]
node cache "Cache lookup" [c6]
@step Enter the service
@step Follow the work
handler -> db: 55
handler -> render: 20
handler -> cache: 5
```
## The same flow, ready to print
```sankey static title="Where a request's time goes" unit=ms
request -> auth: 12
request -> handler: 80
handler -> db: 55
handler -> render: 20
handler -> cache: 5
node request "Incoming request" [c1]
node auth "Authentication" [c2]
node handler "Application processing" [c3]
node db "Database queries" [c4]
node render "Response assembly" [c5]
node cache "Cache lookup" [c6]
```

Callouts

A callout is a note beside the text it is about. A note about the whole page is a callout too: put it under the title. It is a blockquote that opens with a bold marker. The marker picks the icon and the colour; the author never picks an icon.

Source: `fixtures/format/01-callouts.dh.md`
text
---
title: "Callouts"
description: A fixture made from the Format page section of the same name.
---
## Callouts
A callout is a note beside the text it is about. A note about the whole page is a callout too: put it under the title. It is a blockquote that opens with a bold marker. The marker picks the icon and the colour; the author never picks an icon.
> **Note:** a fact worth knowing, but not needed to follow the text.
> **Tip:** press :kbd[Ctrl+K] to search the docs.
> **Important:** the CLI sends every answer on every call.
> **Watch out:** a validate call replays the script with the deterministic state from before the question.
> **Security finding:** (an example, not a real finding) a security block sits on its own; the public LLM view drops it.

Keyboard keys

One key Esc, a combination Ctrl+⇧ Shift+P, and a sequence Ctrl+KthenCtrl+S: press the first, let go, then press the second. Arrow keys are written by name: ← and → step through a stage; the page draws the arrows.

Source: `fixtures/format/02-keyboard-keys.dh.md`
text
---
title: "Keyboard keys"
description: A fixture made from the Format page section of the same name.
---
## Keyboard keys
One key :kbd[Esc], a combination :kbd[Ctrl+Shift+P], and a sequence :kbd[Ctrl+K, Ctrl+S]: press the first, let go, then press the second.
Arrow keys are written by name: :kbd[Left] and :kbd[Right] step through a stage; the page draws the arrows.

Mouse actions

One mouse icon and the action. The button the action presses is filled: the left one for a click, the right one for a right click, the wheel for a middle click. A double click adds a "2", so it never looks like a single click. Scroll adds arrows by the wheel; drag, drop, hover and select add their own small mark.

  • click Next
  • double-click index.ts
  • right-click src/
  • middle-click the tab
  • scroll the list
  • drag README.md
  • drop it on docs/
  • hover the chip
  • select the first line
Source: `fixtures/format/03-mouse-actions.dh.md`
text
---
title: "Mouse actions"
description: A fixture made from the Format page section of the same name.
---
## Mouse actions
One mouse icon and the action. The button the action presses is filled: the left one for a click, the right one for a right click, the wheel for a middle click. A double click adds a "2", so it never looks like a single click. Scroll adds arrows by the wheel; drag, drop, hover and select add their own small mark.
- :mouse[click Next]
- :mouse[double-click index.ts]
- :mouse[right-click src/]
- :mouse[middle-click the tab]
- :mouse[scroll the list]
- :mouse[drag README.md]
- :mouse[drop it on docs/]
- :mouse[hover the chip]
- :mouse[select the first line]

Table of contents

The page form lists the page's headings; depth says how deep it goes.

Source: `fixtures/format/04-table-of-contents.dh.md`
text
---
title: "Table of contents"
description: A fixture made from the Format page section of the same name.
---
## Table of contents
The page form lists the page's headings; `depth` says how deep it goes.
::toc{depth=2}

Tabs

Each heading inside :::tabs starts one tab. An LLM reads the headings and the text under them.

Install with npm i @example/scaffold-sdk.

Source: `fixtures/format/05-tabs.dh.md`
text
---
title: "Tabs"
description: A fixture made from the Format page section of the same name.
---
## Tabs
Each heading inside `:::tabs` starts one tab. An LLM reads the headings and the text under them.
:::tabs
#### Node
Install with `npm i @example/scaffold-sdk`.
#### Python
Install with `pip install scaffold-sdk`.
:::

Accordion

Each heading inside :::accordion starts one row that opens and closes.

Why replay instead of pausing?

A paused script would tie one template container to each person who is answering.

What does a replay cost?

Each call runs the script again from its first line.

Source: `fixtures/format/06-accordion.dh.md`
text
---
title: "Accordion"
description: A fixture made from the Format page section of the same name.
---
## Accordion
Each heading inside `:::accordion` starts one row that opens and closes.
:::accordion
#### Why replay instead of pausing?
A paused script would tie one template container to each person who is answering.
#### What does a replay cost?
Each call runs the script again from its first line.
:::

Human-only segment

A segment for people only. The :::llm block right after it is what an LLM reads instead.

For peopleLLMs read a short text instead.

This segment is long on purpose: it walks a new reader through the idea, slowly, with a picture.

Starts with: person p "person"; box c "CLI"; box t "template container". Connected: p -> c "talks to", c -> t "calls".

talks tocallspersonpersonCLICLItemplate containertemplate container
Source: `fixtures/format/07-human-only-segment.dh.md`
text
---
title: "Human-only segment"
description: A fixture made from the Format page section of the same name.
---
## Human-only segment
A segment for people only. The `:::llm` block right after it is what an LLM reads instead.
:::human
This segment is long on purpose: it walks a new reader through the idea, slowly, with a picture.
```animation
person p "person"
box c "CLI"
box t "template container"
p -> c "talks to"
c -> t "calls"
```
:::
:::llm
The person talks to the CLI, which calls the template container.
:::

A segment LLMs skip

llm=none says, in the source, that LLMs need nothing here.

For peopleLLMs skip this part: the author marked it as not needed by them.

Use ← and → to step through a stage.

Source: `fixtures/format/08-a-segment-llms-skip.dh.md`
text
---
title: "A segment LLMs skip"
description: A fixture made from the Format page section of the same name.
---
## A segment LLMs skip
`llm=none` says, in the source, that LLMs need nothing here.
:::human llm=none
Use :kbd[Left] and :kbd[Right] to step through a stage.
:::

Still scene

Boxes joined by lines are an animation. With no @step line it stands still: drawn once, with no player. An LLM reads what it starts with and what is connected.

Starts with: box cli "CLI"; box tc "template container"; box out "project folder". Connected: cli -> tc "init call", tc -> out "writes the files".

init callwrites the filesCLICLItemplate containertemplate containerproject folderproject folder
Source: `fixtures/format/09-still-scene.dh.md`
text
---
title: "Still scene"
description: A fixture made from the Format page section of the same name.
---
## Still scene
Boxes joined by lines are an `animation`. With no `@step` line it stands still: drawn once, with no player. An LLM reads what it starts with and what is connected.
```animation
box cli "CLI"
box tc "template container"
cli -> tc "init call"
box out "project folder"
tc -> out "writes the files"
```

Steps on any part

Steps are not a part of their own: any part becomes step by step when it holds @step lines. Here a sequence builds up one call a step.

init call: allanswers
1The CLI sends an init call with every answer it holds.
1 / 3
Source: `fixtures/format/10-steps-on-any-part.dh.md`
text
---
title: "Steps on any part"
description: A fixture made from the Format page section of the same name.
---
## Steps on any part
Steps are not a part of their own: any part becomes step by step when it holds `@step` lines. Here a sequence builds up one call a step.
```sequence
participant cli "CLI"
participant tc "template container"
@step The CLI sends an init call with every answer it holds.
cli -> tc: init call: all answers
@step The script stops at a question and sends it back.
tc --> cli: question reply
@step The next init call carries one answer more.
cli -> tc: init call: one more answer
```

Chart: bar

An LLM reads a chart's data as a table.

Answers carried by each init call
Show the numbers as a table
init callanswers
10
21
32
43
54
Source: `fixtures/format/11-chart-bar.dh.md`
text
---
title: "Chart: bar"
description: A fixture made from the Format page section of the same name.
---
## Chart: bar
An LLM reads a chart's data as a table.
```chart
kind: bar
title: Answers carried by each init call
x: { label: init call, values: [1, 2, 3, 4, 5] }
y: { label: answers }
series:
- name: answers
data: [0, 1, 2, 3, 4]
```

Chart: grouped bars

Several series side by side is the default for bars.

Runs per create, by number of questions
Show the numbers as a table
questionsinit callsvalidate callsboth
2325
4549
67613
Source: `fixtures/format/12-chart-grouped-bars.dh.md`
text
---
title: "Chart: grouped bars"
description: A fixture made from the Format page section of the same name.
---
## Chart: grouped bars
Several series side by side is the default for bars.
```chart
kind: bar
title: Runs per create, by number of questions
x: { label: questions, values: [2, 4, 6] }
y: { label: runs }
series:
- name: init calls
data: [3, 5, 7]
- name: validate calls
data: [2, 4, 6]
- name: both
data: [5, 9, 13]
```

Chart: stacked bar

Size of each init call, in bytes
Show the numbers as a table
init callanswersdeterministic state
100
24840
39640
414440
Source: `fixtures/format/13-chart-stacked-bar.dh.md`
text
---
title: "Chart: stacked bar"
description: A fixture made from the Format page section of the same name.
---
## Chart: stacked bar
```chart
kind: bar
stacked: true
title: Size of each init call, in bytes
x: { label: init call, values: [1, 2, 3, 4] }
y: { label: bytes }
series:
- name: answers
data: [0, 48, 96, 144]
- name: deterministic state
data: [0, 40, 40, 40]
```

Chart: 100% stacked bar

stacked: percent scales each bar to 100%; the tooltip still shows the real number. Init call 1 carries nothing, so it has no share and is left out.

Share of each init call's size
Show the numbers as a table
init callanswersdeterministic state
24840
39640
414440
Source: `fixtures/format/14-chart-100-stacked-bar.dh.md`
text
---
title: "Chart: 100% stacked bar"
description: A fixture made from the Format page section of the same name.
---
## Chart: 100% stacked bar
`stacked: percent` scales each bar to 100%; the tooltip still shows the real number. Init call 1 carries nothing, so it has no share and is left out.
```chart
kind: bar
stacked: percent
title: Share of each init call's size
x: { label: init call, values: [2, 3, 4] }
y: { label: share of bytes }
series:
- name: answers
data: [48, 96, 144]
- name: deterministic state
data: [40, 40, 40]
```

Chart: horizontal bar

horizontal: true turns the bars on their side; long names get room.

Time to create, by way of working
Show the numbers as a table
wayseconds
Edit files by hand95
Run the template once12
Ask every question31
Replay all answers48
Source: `fixtures/format/15-chart-horizontal-bar.dh.md`
text
---
title: "Chart: horizontal bar"
description: A fixture made from the Format page section of the same name.
---
## Chart: horizontal bar
`horizontal: true` turns the bars on their side; long names get room.
```chart
kind: bar
horizontal: true
title: Time to create, by way of working
x: { label: way, values: [Edit files by hand, Run the template once, Ask every question, Replay all answers] }
y: { label: seconds }
series:
- name: seconds
data: [95, 12, 31, 48]
```

Chart: floating bars

A value written [low, high] floats the bar between the two. The LLM table reads it as "3 to 9".

Time each step takes, in seconds
Show the numbers as a table
steprange
Ask0–4
Validate4–9
Generate9–21
Write21–26
Source: `fixtures/format/16-chart-floating-bars.dh.md`
text
---
title: "Chart: floating bars"
description: A fixture made from the Format page section of the same name.
---
## Chart: floating bars
A value written `[low, high]` floats the bar between the two. The LLM table reads it as "3 to 9".
```chart
kind: bar
title: Time each step takes, in seconds
x: { label: step, values: [Ask, Validate, Generate, Write] }
y: { label: seconds }
series:
- name: range
data: [[0, 4], [4, 9], [9, 21], [21, 26]]
```

Chart: line

Script runs per create, by number of questions
Show the numbers as a table
questionsinit callswith one validate call per question
123
235
347
459
5611
6713
Source: `fixtures/format/17-chart-line.dh.md`
text
---
title: "Chart: line"
description: A fixture made from the Format page section of the same name.
---
## Chart: line
```chart
kind: line
title: Script runs per create, by number of questions
x: { label: questions, values: [1, 2, 3, 4, 5, 6] }
y: { label: runs }
series:
- name: init calls
data: [2, 3, 4, 5, 6, 7]
- name: with one validate call per question
data: [3, 5, 7, 9, 11, 13]
```

Chart: area

Answers sent in all, after each init call
Show the numbers as a table
init callanswers sent
10
21
33
46
510
615
Source: `fixtures/format/18-chart-area.dh.md`
text
---
title: "Chart: area"
description: A fixture made from the Format page section of the same name.
---
## Chart: area
```chart
kind: area
title: Answers sent in all, after each init call
x: { label: init call, values: [1, 2, 3, 4, 5, 6] }
y: { label: answers sent so far }
series:
- name: answers sent
data: [0, 1, 3, 6, 10, 15]
```

Chart: stacked area

Calls sent so far, by kind
Show the numbers as a table
init callinit callsvalidate calls
110
221
332
443
554
Source: `fixtures/format/19-chart-stacked-area.dh.md`
text
---
title: "Chart: stacked area"
description: A fixture made from the Format page section of the same name.
---
## Chart: stacked area
```chart
kind: area
stacked: true
title: Calls sent so far, by kind
x: { label: init call, values: [1, 2, 3, 4, 5] }
y: { label: calls }
series:
- name: init calls
data: [1, 2, 3, 4, 5]
- name: validate calls
data: [0, 1, 2, 3, 4]
```

Chart: mixed bars and line, two axes

A series can have its own kind, and axis: y2 puts it on a second axis on the right. The chart declares that axis with y2.

Runs and time, by number of questions
Show the numbers as a table
questionsrunstime
124
237
3411
4516
5622
Source: `fixtures/format/20-chart-mixed-bars-and-line-two-axes.dh.md`
text
---
title: "Chart: mixed bars and line, two axes"
description: A fixture made from the Format page section of the same name.
---
## Chart: mixed bars and line, two axes
A series can have its own `kind`, and `axis: y2` puts it on a second axis on the right. The chart declares that axis with `y2`.
```chart
kind: bar
title: Runs and time, by number of questions
x: { label: questions, values: [1, 2, 3, 4, 5] }
y: { label: runs }
y2: { label: seconds, min: 0 }
series:
- name: runs
data: [2, 3, 4, 5, 6]
- name: time
kind: line
axis: y2
tone: 5
data: [4, 7, 11, 16, 22]
```

Chart: log scale

scale: log on an axis spaces the ticks by powers of ten. It needs values above 0.

Size of the answer set, by number of questions
Show the numbers as a table
questionsanswer sets
13
29
327
481
5243
6729
Source: `fixtures/format/21-chart-log-scale.dh.md`
text
---
title: "Chart: log scale"
description: A fixture made from the Format page section of the same name.
---
## Chart: log scale
`scale: log` on an axis spaces the ticks by powers of ten. It needs values above 0.
```chart
kind: line
title: Size of the answer set, by number of questions
x: { label: questions, values: [1, 2, 3, 4, 5, 6] }
y: { label: possible answer sets, scale: log }
series:
- name: answer sets
data: [3, 9, 27, 81, 243, 729]
```

Chart: scatter

Body size against answers carried
Show the numbers as a table
seriesanswersbytes
init calls040
init calls192
init calls2139
init calls3190
init calls4236
init calls5288
Source: `fixtures/format/22-chart-scatter.dh.md`
text
---
title: "Chart: scatter"
description: A fixture made from the Format page section of the same name.
---
## Chart: scatter
```chart
kind: scatter
title: Body size against answers carried
x: { label: answers }
y: { label: bytes }
series:
- name: init calls
data: [[0, 40], [1, 92], [2, 139], [3, 190], [4, 236], [5, 288]]
```

Chart: scatter on log scales

Both axes of a scatter chart can be log.

Run time against input size
Show the numbers as a table
seriesquestionsmilliseconds
runs112
runs335
runs10120
runs30340
runs1001,200
runs3003,500
Source: `fixtures/format/23-chart-scatter-on-log-scales.dh.md`
text
---
title: "Chart: scatter on log scales"
description: A fixture made from the Format page section of the same name.
---
## Chart: scatter on log scales
Both axes of a scatter chart can be log.
```chart
kind: scatter
title: Run time against input size
x: { label: questions, scale: log }
y: { label: milliseconds, scale: log }
series:
- name: runs
data: [[1, 12], [3, 35], [10, 120], [30, 340], [100, 1200], [300, 3500]]
```

Chart: bubble

A bubble point is [x, y, size]; the area of the bubble follows the size.

Templates by questions, run time and downloads
Show the numbers as a table
seriesquestionssecondssize
templates38120
templates614480
templates93060
templates1241900
templates1552240
Source: `fixtures/format/24-chart-bubble.dh.md`
text
---
title: "Chart: bubble"
description: A fixture made from the Format page section of the same name.
---
## Chart: bubble
A bubble point is `[x, y, size]`; the area of the bubble follows the size.
```chart
kind: bubble
title: Templates by questions, run time and downloads
x: { label: questions }
y: { label: seconds }
series:
- name: templates
data: [[3, 8, 120], [6, 14, 480], [9, 30, 60], [12, 41, 900], [15, 52, 240]]
```

Chart: candlestick

A candlestick chart draws one candle per period. Its series has no kind, and each value is four numbers, [open, high, low, close]. The body runs from the open to the close and the thin line (the wick) from the low to the high. A candle that closes at or above its open is up (green, light body); one that closes below is down (pink, solid body). Hover or tap a candle to read all four numbers.

One week of a share price
Up: the close is at or above the openDown: the close is below the open
Show the numbers as a table
dayOpenHighLowClose
Mon10010898105
Tue105110101102
Wed1021049596
Thu9610394101
Fri101109100108
Source: `fixtures/format/25-chart-candlestick.dh.md`
text
---
title: "Chart: candlestick"
description: A fixture made from the Format page section of the same name.
---
## Chart: candlestick
A candlestick chart draws one candle per period. Its series has no `kind`, and each value is four numbers, `[open, high, low, close]`. The body runs from the open to the close and the thin line (the wick) from the low to the high. A candle that closes at or above its open is up (green, light body); one that closes below is down (pink, solid body). Hover or tap a candle to read all four numbers.
```chart
kind: candlestick
title: One week of a share price
x: { label: day, values: [Mon, Tue, Wed, Thu, Fri] }
y: { label: price, min: 90 }
series:
- name: price
data: [[100, 108, 98, 105], [105, 110, 101, 102], [102, 104, 95, 96], [96, 103, 94, 101], [101, 109, 100, 108]]
```

Chart: candlestick with a moving average

Another series with kind: line draws on top of the candles: here the average of the last three closing prices. It may use y2 for a second axis, like any other chart.

Two weeks of a share price, with its 3-day average
Up: the close is at or above the openDown: the close is below the open
Show the numbers as a table
dayOpenHighLowClose3-day average
110010698104
2104109102107
3107111105106105.7
4106108101102105
51021059799102.3
69910496103101.3
7103110102109103.7
8109113107112108
9112114108109110
10109112106111110.7
Source: `fixtures/format/26-chart-candlestick-with-a-moving-average.dh.md`
text
---
title: "Chart: candlestick with a moving average"
description: A fixture made from the Format page section of the same name.
---
## Chart: candlestick with a moving average
Another series with `kind: line` draws on top of the candles: here the average of the last three closing prices. It may use `y2` for a second axis, like any other chart.
```chart
kind: candlestick
title: Two weeks of a share price, with its 3-day average
x: { label: day, values: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] }
y: { label: price, min: 90 }
series:
- name: price
data: [[100, 106, 98, 104], [104, 109, 102, 107], [107, 111, 105, 106], [106, 108, 101, 102], [102, 105, 97, 99], [99, 104, 96, 103], [103, 110, 102, 109], [109, 113, 107, 112], [112, 114, 108, 109], [109, 112, 106, 111]]
- name: 3-day average
kind: line
tone: 6
data: [null, null, 105.7, 105, 102.3, 101.3, 103.7, 108, 110, 110.7]
```

Chart: radar

The x list names the axes (at least three); each series is one outline.

Two ways of replaying answers
Show the numbers as a table
Replay all answersKeep a session
Speed35
Safety52
Size24
Clarity43
Cost42
Source: `fixtures/format/27-chart-radar.dh.md`
text
---
title: "Chart: radar"
description: A fixture made from the Format page section of the same name.
---
## Chart: radar
The x list names the axes (at least three); each series is one outline.
```chart
kind: radar
title: Two ways of replaying answers
x: [Speed, Safety, Size, Clarity, Cost]
series:
- name: Replay all answers
data: [3, 5, 2, 4, 4]
- name: Keep a session
data: [5, 2, 4, 3, 2]
```

Chart: pie

Time in one create
Show the numbers as a table
seconds
Ask4
Validate5
Generate12
Write5
Source: `fixtures/format/28-chart-pie.dh.md`
text
---
title: "Chart: pie"
description: A fixture made from the Format page section of the same name.
---
## Chart: pie
```chart
kind: pie
title: Time in one create
x: { values: [Ask, Validate, Generate, Write] }
series:
- name: seconds
data: [4, 5, 12, 5]
```

Chart: doughnut

Where the script's runs go, for 3 questions
Show the numbers as a table
runs
init calls4
validate calls2
Source: `fixtures/format/29-chart-doughnut.dh.md`
text
---
title: "Chart: doughnut"
description: A fixture made from the Format page section of the same name.
---
## Chart: doughnut
```chart
kind: doughnut
title: Where the script's runs go, for 3 questions
x: { values: [init calls, validate calls] }
series:
- name: runs
data: [4, 2]
```

Chart: polar area

Like a pie, but every slice has the same angle and its value is the length.

Calls by hour of the day
Show the numbers as a table
calls
Morning34
Noon52
Afternoon61
Evening28
Night9
Source: `fixtures/format/30-chart-polar-area.dh.md`
text
---
title: "Chart: polar area"
description: A fixture made from the Format page section of the same name.
---
## Chart: polar area
Like a pie, but every slice has the same angle and its value is the length.
```chart
kind: polar
title: Calls by hour of the day
x: { values: [Morning, Noon, Afternoon, Evening, Night] }
series:
- name: calls
data: [34, 52, 61, 28, 9]
```

Chart with controls

The reader moves the slider or picks a view; the chart redraws from its formulas. A chart with formulas goes to an LLM as its source, since the formulas say more than one set of numbers.

Answers carried by each init call
Show the numbers as a table
answers
10
21
32
43
54
65
76
Source: `fixtures/format/31-chart-with-controls.dh.md`
text
---
title: "Chart with controls"
description: A fixture made from the Format page section of the same name.
---
## Chart with controls
The reader moves the slider or picks a view; the chart redraws from its formulas. A chart with formulas goes to an LLM as its source, since the formulas say more than one set of numbers.
```chart
kind: bar
title: Answers carried by each init call
controls:
- slider: questions
label: Questions in the script
min: 1
max: 20
value: 6
- select: view
label: Show
options: [per call, running total]
let:
calls: range(1, questions + 1)
carried: calls - 1
x: calls
y: { label: answers }
series:
- name: answers
data: "view == 'per call' ? carried : cumsum(carried)"
```

Tier list

A tier list ranks items in rows, best first. Write one line per tier: its name, a colon, then its items with commas between them. A short note goes in brackets after an item; the page shows it when a reader taps or hovers the item. An LLM reads the same lines.

Databases for a small team
S
A
MySQL
B
MongoDBDynamoDB
C
D
A spreadsheet
Tap or hover an item with a dot to read its note.
Source: `fixtures/format/32-tier-list.dh.md`
text
---
title: "Tier list"
description: A fixture made from the Format page section of the same name.
---
## Tier list
A tier list ranks items in rows, best first. Write one line per tier: its name, a colon, then its items with commas between them. A short note goes in brackets after an item; the page shows it when a reader taps or hovers the item. An LLM reads the same lines.
```tierlist title="Databases for a small team"
S: Postgres (does almost everything), SQLite (no server to run)
A: MySQL, "Redis, as a cache" (fast, but memory is dear)
B: MongoDB, DynamoDB
C: Cassandra (great at scale, hard to run small)
D: A spreadsheet
```

Tier list: your own tiers

The tiers are S, A, B, C and D unless you say otherwise. A list may have any tiers, in any number. Start with a line tiers: that names them; a name may be followed by a colour in square brackets (c1 to c8, good, warn or bad). The tier lines use those names; a tier with no line is an empty row. This list has four tiers.

What the first release needs
Must
Sign in
Should
Email receiptsA dark theme
Could
Won't
A mobile app
Tap or hover an item with a dot to read its note.
Source: `fixtures/format/33-tier-list-your-own-tiers.dh.md`
text
---
title: "Tier list: your own tiers"
description: A fixture made from the Format page section of the same name.
---
## Tier list: your own tiers
The tiers are S, A, B, C and D unless you say otherwise. **A list may have any tiers, in any number.** Start with a line `tiers:` that names them; a name may be followed by a colour in square brackets (`c1` to `c8`, `good`, `warn` or `bad`). The tier lines use those names; a tier with no line is an empty row. This list has four tiers.
```tierlist title="What the first release needs"
tiers: Must [good], Should [c6], Could [c3], Won't [bad]
Must: Sign in, Pay by card (one provider)
Should: Email receipts, A dark theme
Could: Gift cards (needs a legal check)
Won't: A mobile app
```

Tier list: three tiers, or seven

There is no limit of four or five. Three tiers are enough for a short list; seven fit a scale with many steps. Only the names on the tiers: line count.

Is it worth doing?
Yes
Cache the buildAdd a sample
Maybe
No
Support every browser ever
Tap or hover an item with a dot to read its note.
How far along is each part?
Shipped
TerminalFile tree
Beta
Editor
Alpha
Animation in 3D
Prototype
Tier list
Sketch
Voice over
Idea
A map part
Dropped
A clock part
Source: `fixtures/format/34-tier-list-three-tiers-or-seven.dh.md`
text
---
title: "Tier list: three tiers, or seven"
description: A fixture made from the Format page section of the same name.
---
## Tier list: three tiers, or seven
There is no limit of four or five. Three tiers are enough for a short list; seven fit a scale with many steps. Only the names on the `tiers:` line count.
```tierlist title="Is it worth doing?"
tiers: Yes [good], Maybe [warn], No [bad]
Yes: Cache the build, Add a sample
Maybe: Rewrite the docs site (a lot of work)
No: Support every browser ever
```
```tierlist title="How far along is each part?"
tiers: Shipped [good], Beta [c6], Alpha [c4], Prototype [c3], Sketch [c5], Idea [c7], Dropped [bad]
Shipped: Terminal, File tree
Beta: Editor
Alpha: Animation in 3D
Prototype: Tier list
Sketch: Voice over
Idea: A map part
Dropped: A clock part
```

Alignment grid

An alignment grid has two axes, each with a name at both ends and any names between (the classic one is lawful .. chaotic by good .. evil). The first name is the left (or top) end. Put items in a cell by its column and row names, column / row: item, item; a "label" before the colon names the cell.

Which kind of hero?
lawful
neutral
chaotic
good
Crusader
Cleric
Rebel
neutral
Balance
Monk
evil
Tyrant
Raider
Tap or hover an item with a dot to read its note.
Source: `fixtures/format/35-alignment-grid.dh.md`
text
---
title: "Alignment grid"
description: A fixture made from the Format page section of the same name.
---
## Alignment grid
An alignment grid has two axes, each with a name at both ends and any names between (the classic one is lawful .. chaotic by good .. evil). The first name is the left (or top) end. Put items in a cell by its column and row names, `column / row: item, item`; a `"label"` before the colon names the cell.
```alignment title="Which kind of hero?"
x: lawful .. neutral .. chaotic
y: good .. neutral .. evil
lawful / good "Crusader": Paladin (keeps every oath), Cleric
neutral / good: Druid (looks after the land)
chaotic / good "Rebel": Bard (helps, breaks the rules)
neutral / neutral "Balance": Monk
lawful / evil "Tyrant": Warlock (a contract for everything)
chaotic / evil "Raider": Rogue (takes what it wants)
```

Alignment grid: points

An item can sit at a point instead: item @ x, y, with x and y from 0 to 1 (0 is the first end of the axis, 1 the last, 0.5 the middle). Cells and points can be mixed; here the cells only carry labels.

Which task first?
low effort
high effort
high impact
Do first
Plan it
low impact
Fill a gap
Skip
Speed up the build
Rewrite the docs site
Rename a variable
Move the logo
Tap or hover an item with a dot to read its note.
Source: `fixtures/format/36-alignment-grid-points.dh.md`
text
---
title: "Alignment grid: points"
description: A fixture made from the Format page section of the same name.
---
## Alignment grid: points
An item can sit at a point instead: `item @ x, y`, with x and y from 0 to 1 (0 is the first end of the axis, 1 the last, 0.5 the middle). Cells and points can be mixed; here the cells only carry labels.
```alignment title="Which task first?"
x: low effort .. high effort
y: high impact .. low impact
low effort / high impact "Do first":
high effort / high impact "Plan it":
low effort / low impact "Fill a gap":
high effort / low impact "Skip":
Fix the typo (one line) @ 0.12, 0.22
Add a sample (people copy it) @ 0.32, 0.3
Speed up the build @ 0.66, 0.2
Rewrite the docs site @ 0.86, 0.62
Rename a variable @ 0.14, 0.78
Move the logo @ 0.4, 0.88
```

Alignment grid: any size

Each axis has 2 to 6 names, and the two axes need not match: this grid has five columns and three rows. A grid with more names than that would have cells too small to read.

How far along is each part?
idea
sketch
draft
review
shipped
small
A clock part
Done
Terminal
medium
A map part
Tier list
EditorFile tree
large
Animation in 3D
Source: `fixtures/format/37-alignment-grid-any-size.dh.md`
text
---
title: "Alignment grid: any size"
description: A fixture made from the Format page section of the same name.
---
## Alignment grid: any size
Each axis has 2 to 6 names, and the two axes need not match: this grid has five columns and three rows. A grid with more names than that would have cells too small to read.
```alignment title="How far along is each part?"
x: idea .. sketch .. draft .. review .. shipped
y: small .. medium .. large
idea / small: A clock part
sketch / medium: A map part
draft / medium: Tier list
review / large: Animation in 3D
shipped / small "Done": Terminal
shipped / medium: Editor, File tree
```

Alignment grid: colours and regions

[colour] after a cell's name (and its label) tints that cell. A region: line paints a block of cells with a label: write its columns and rows, each one name or first .. last. Colours are the theme names c1 to c8, good, warn and bad, never a hex value. arrows: on draws an arrow along each axis. A cell's own colour wins over its region's; regions may not overlap.

Where does each task go?
low effort
medium
high effort
high impact
Do first
Fix the typo
Add a sample
medium
Speed up the build
low impact
Rewrite the docs site
Tap or hover an item with a dot to read its note.
Source: `fixtures/format/38-alignment-grid-colours-and-regions.dh.md`
text
---
title: "Alignment grid: colours and regions"
description: A fixture made from the Format page section of the same name.
---
## Alignment grid: colours and regions
`[colour]` after a cell's name (and its label) tints that cell. A `region:` line paints a block of cells with a label: write its columns and rows, each one name or `first .. last`. Colours are the theme names `c1` to `c8`, `good`, `warn` and `bad`, never a hex value. `arrows: on` draws an arrow along each axis. A cell's own colour wins over its region's; regions may not overlap.
```alignment title="Where does each task go?"
x: low effort .. medium .. high effort
y: high impact .. medium .. low impact
arrows: on
region: low effort .. medium / high impact .. medium "Quick wins" [good]
region: high effort / low impact "Avoid" [bad]
low effort / high impact "Do first" [c6]: Fix the typo
medium / high impact: Add a sample
low effort / medium: Speed up the build
high effort / high impact: Move to the new CI (needs a plan)
high effort / low impact: Rewrite the docs site
```

File tree

Explorer
  • .scaffold_state.yamlnewanswers, kept for update
  • README.mdgenerated
Source: `fixtures/format/39-file-tree.dh.md`
text
---
title: "File tree"
description: A fixture made from the Format page section of the same name.
---
## File tree
```filetree
hello-app/
.scaffold_state.yaml (new) # answers, kept for update
README.md (generated)
node_modules/ (closed)
...
```

File tree with steps

ExplorerAfter scaffold create
  • .scaffold_state.yamlnewanswers, kept for update
  • README.mdgenerated
1 / 2
Source: `fixtures/format/40-file-tree-with-steps.dh.md`
text
---
title: "File tree with steps"
description: A fixture made from the Format page section of the same name.
---
## File tree with steps
```filetree
@step After scaffold create
hello-app/
.scaffold_state.yaml (new) # answers, kept for update
README.md (generated)
@step After the user edits it
hello-app/
.scaffold_state.yaml
README.md (changed) # the user's own edit
LICENSE (new)
old-notes.txt (removed)
```

Marks and prefixes

Every mark is written as a word in the source. Each part has a built-in list, and a page or a site may add its own (see the last block of this section); doccheck refuses a word that is in neither. The page shows the word as a chip, so there are no letters to learn.

File tree: the mark goes in brackets after the name.

WrittenThe page showsMeaning
(new)a green "new" chipthe file did not exist before
(changed)an orange "changed" chipthe file existed and was edited
(removed)a pink "removed" chip, name struckthe file is deleted
(generated)a blue "generated" chipa tool made it; do not edit by hand
(conflict)a pink "conflict" chiptwo changes disagree here
(closed)the folder starts closedonly on a folder
# texta note after the name
...a "more files" rowentries left out

Editor: a step's lines are a diff of the file shown.

WrittenMeaning
+linethe line is added (green)
-linethe line is removed (pink, under "Before")
line (a space)the line is kept, to say where the edit is
@@ <path>the edit is in this file
@file <path>a made-up file; its lines follow
(open)the file shown first
an "edited" chip in the treethe page adds it to a file a step has changed

Terminal: only the start of a line counts.

WrittenMeaning
$ or % a command, typed at that prompt
# a command typed as root
anything elseoutput, shown as it is

Your own marks and prefixes. A page may define its own, and a site too (see section 3.1 of the spec): a name, a label and a colour. They show only where a part uses them. The front matter of this page defines two marks and one prompt:

Explorer
  • api.ts
  • parse.tsdeprecated
  • next.tsexperimentalnew
  • deprecated still works, but will be removed
  • experimental may change without notice
Terminal
$python3
$
  • >>> Python a line typed at the Python prompt
1 / 2

Code walk: focus=17-18 marks the lines the note is about; mark=29 puts a marker on one line.

Source: `fixtures/format/41-marks-and-prefixes.dh.md`
text
---
title: "Marks and prefixes"
description: A fixture made from the Format page section of the same name.
marks:
deprecated:
label: deprecated
colour: warn
means: still works, but will be removed
experimental:
label: experimental
colour: c3
means: may change without notice
prefixes:
">>>":
label: Python
colour: c4
means: a line typed at the Python prompt
---
## Marks and prefixes
Every mark is written as a word in the source. Each part has a built-in list, and a page or a site may add its own (see the last block of this section); doccheck refuses a word that is in neither. The page shows the word as a chip, so there are no letters to learn.
**File tree:** the mark goes in brackets after the name.
| Written | The page shows | Meaning |
| --- | --- | --- |
| `(new)` | a green "new" chip | the file did not exist before |
| `(changed)` | an orange "changed" chip | the file existed and was edited |
| `(removed)` | a pink "removed" chip, name struck | the file is deleted |
| `(generated)` | a blue "generated" chip | a tool made it; do not edit by hand |
| `(conflict)` | a pink "conflict" chip | two changes disagree here |
| `(closed)` | the folder starts closed | only on a folder |
| `# text` | a note after the name | |
| `...` | a "more files" row | entries left out |
**Editor:** a step's lines are a diff of the file shown.
| Written | Meaning |
| --- | --- |
| `+line` | the line is added (green) |
| `-line` | the line is removed (pink, under "Before") |
| ` line` (a space) | the line is kept, to say where the edit is |
| `@@ <path>` | the edit is in this file |
| `@file <path>` | a made-up file; its lines follow |
| `(open)` | the file shown first |
| an "edited" chip in the tree | the page adds it to a file a step has changed |
**Terminal:** only the start of a line counts.
| Written | Meaning |
| --- | --- |
| `$ ` or `% ` | a command, typed at that prompt |
| `# ` | a command typed as root |
| anything else | output, shown as it is |
**Your own marks and prefixes.** A page may define its own, and a site too (see section 3.1 of the spec): a name, a label and a colour. They show only where a part uses them. The front matter of this page defines two marks and one prompt:
```filetree
app/
api.ts
parse.ts (deprecated)
next.ts (experimental) (new)
```
```terminal
$ python3
>>> print(1 + 1)
2
```
**Code walk:** `focus=17-18` marks the lines the note is about; `mark=29` puts a marker on one line.

Editor

A small IDE: the file tree on the left and one file pane. Files come from a repo at the page's pin, or are made up right here with @file. Each @step is an edit: + adds a line, - removes one, a space keeps one; @@ <file> picks the file.

src › index.ts
import { greet } from './greet';
console.log(greet('hello-app'));
1The files as they are
1 / 3
Source: `fixtures/format/42-editor.dh.md`
text
---
title: "Editor"
description: A fixture made from the Format page section of the same name.
---
## Editor
A small IDE: the file tree on the left and one file pane. Files come from a repo at the page's pin, or are made up right here with `@file`. Each `@step` is an edit: `+` adds a line, `-` removes one, a space keeps one; `@@ <file>` picks the file.
```editor
@file src/index.ts (open)
import { greet } from './greet';
console.log(greet('hello-app'));
@file src/greet.ts
export function greet(name: string) {
return 'Hi ' + name;
}
@step Greet with an exclamation mark
@@ src/greet.ts
export function greet(name: string) {
- return 'Hi ' + name;
+ return 'Hi ' + name + '!';
}
@step Pass the license too
@@ src/index.ts
-console.log(greet('hello-app'));
+console.log(greet('hello-app'), 'MIT');
```

Terminal

The shell-session convention every docs site already uses (it is GitHub's and Shiki's console/shellsession): a line that starts with $ (or % , or # for root) is a command, typed at that prompt and highlighted as bash; every other line is output, shown as it is, including a program's own questions and the answers typed into them. Each command is one step. The fence names console and shellsession give the same part.

Terminal
$scaffold create acme/hello ./hello-app
? Project name? hello-app
? License? MIT
✔ Created hello-app
$
1 / 3
Source: `fixtures/format/43-terminal.dh.md`
text
---
title: "Terminal"
description: A fixture made from the Format page section of the same name.
---
## Terminal
The shell-session convention every docs site already uses (it is GitHub's and Shiki's `console`/`shellsession`): a line that starts with `$ ` (or `% `, or `# ` for root) is a command, typed at that prompt and highlighted as bash; every other line is output, shown as it is, including a program's own questions and the answers typed into them. Each command is one step. The fence names `console` and `shellsession` give the same part.
```terminal
$ scaffold create acme/hello ./hello-app
? Project name? hello-app
? License? MIT
✔ Created hello-app
$ ls hello-app | grep -v node_modules
README.md
.scaffold_state.yaml
# chown -R app:app hello-app
```

Code walk with inline code

A code walk takes code written right here too, with the editor's syntax: before the first @step, @file <path> makes a file up and its lines follow. A step then names that path; its range may be left out (the whole file). The editor reads repo files the same way the code walk does, so both parts take either.

src/greet.tslines 1–4
export function greet(name: string) {
const clean = name.trim();
return 'Hi ' + clean + '!';
}
1Trim the name first.
1 / 2
Source: `fixtures/format/44-code-walk-with-inline-code.dh.md`
text
---
title: "Code walk with inline code"
description: A fixture made from the Format page section of the same name.
---
## Code walk with inline code
A code walk takes code written right here too, with the editor's syntax: before the first `@step`, `@file <path>` makes a file up and its lines follow. A step then names that path; its range may be left out (the whole file). The editor reads repo files the same way the code walk does, so both parts take either.
```codewalk
@file src/greet.ts
export function greet(name: string) {
const clean = name.trim();
return 'Hi ' + clean + '!';
}
@step src/greet.ts focus=2
Trim the name first.
@step src/greet.ts#L3 focus=3
Then build the greeting.
```

Code walk: animated or still

A code walk has two modes. Still is for moving between different functions or files: the step's file is shown whole, the step's lines are open and marked, and the rest of the file is folded into a bar like "… 12 lines" that the reader can open. A move to the next step switches the marks and the folds at once, with no morph, because a morph between two different functions only confuses. Animated is for the same code changing, such as one function growing step by step: the lines morph into each other.

Nothing needs to be written: a move is animated when the next step is in the same file and its lines touch the lines of the step before; every other move is still. To say it, put animate=on or animate=off on the fence (every move) or on a @step line (the move into that step); animate=auto is the default.

Still: three steps across two files and three functions.

src/cart.tslines 1–8
export function addItem(cart: Cart, item: Item): Cart {
const found = cart.items.find((i) => i.sku === item.sku);
if (found) {
found.qty += item.qty;
return cart;
}
return { ...cart, items: [...cart.items, item] };
}
1Adding an item that is already in the cart only raises its quantity.
1 / 3

Animated: one function growing, one line at a time.

src/slug.tslines 1–2
export function slugify(title: string): string {
const lower = title.toLowerCase();
1Start with the lower-case title.
1 / 4
Source: `fixtures/format/45-code-walk-animated-or-still.dh.md`
text
---
title: "Code walk: animated or still"
description: A fixture made from the Format page section of the same name.
---
## Code walk: animated or still
A code walk has two modes. **Still** is for moving between different functions or files: the step's file is shown whole, the step's lines are open and marked, and the rest of the file is folded into a bar like "… 12 lines" that the reader can open. A move to the next step switches the marks and the folds at once, with no morph, because a morph between two different functions only confuses. **Animated** is for the same code changing, such as one function growing step by step: the lines morph into each other.
Nothing needs to be written: a move is animated when the next step is in the same file and its lines touch the lines of the step before; every other move is still. To say it, put `animate=on` or `animate=off` on the fence (every move) or on a `@step` line (the move into that step); `animate=auto` is the default.
Still: three steps across two files and three functions.
```codewalk
@file src/cart.ts
export function addItem(cart: Cart, item: Item): Cart {
const found = cart.items.find((i) => i.sku === item.sku);
if (found) {
found.qty += item.qty;
return cart;
}
return { ...cart, items: [...cart.items, item] };
}
export function removeItem(cart: Cart, sku: string): Cart {
return { ...cart, items: cart.items.filter((i) => i.sku !== sku) };
}
export function total(cart: Cart): number {
let sum = 0;
for (const i of cart.items) sum += price(i) * i.qty;
return sum;
}
@file src/price.ts
const RATES: Record<string, number> = { food: 0.05, book: 0, other: 0.2 };
export function price(item: Item): number {
const tax = RATES[item.kind] ?? RATES.other;
return Math.round(item.cents * (1 + tax));
}
@step src/cart.ts#L1-L8 focus=3-6
Adding an item that is already in the cart only raises its quantity.
@step src/cart.ts#L14-L18 focus=16
The total adds up one price for each item, times its quantity.
@step src/price.ts#L1-L6 focus=4-5
The price of one item is its cents plus the tax for its kind.
```
Animated: one function growing, one line at a time.
```codewalk
@file src/slug.ts
export function slugify(title: string): string {
const lower = title.toLowerCase();
const words = lower.split(/[^a-z0-9]+/);
const clean = words.filter(Boolean);
return clean.join('-');
}
@step src/slug.ts#L1-L2 focus=2
Start with the lower-case title.
@step #L1-L3 focus=3
Split it at anything that is not a letter or a digit.
@step #L1-L4 focus=4
Splitting can leave empty words at the edges; drop them.
@step #L1-L5 focus=5
Join the words with dashes.
```

Replacing a part for LLMs

Any part can be followed by :::llm; an LLM reads that text instead of the part.

Explorer
  • .scaffold_state.yamlnew
  • README.mdgenerated
  • LICENSEgenerated
  • package.jsongenerated
  • index.tsgenerated
Source: `fixtures/format/46-replacing-a-part-for-llms.dh.md`
text
---
title: "Replacing a part for LLMs"
description: A fixture made from the Format page section of the same name.
---
## Replacing a part for LLMs
Any part can be followed by `:::llm`; an LLM reads that text instead of the part.
```filetree
hello-app/
.scaffold_state.yaml (new)
README.md (generated)
LICENSE (generated)
package.json (generated)
src/
index.ts (generated)
```
:::llm
`scaffold create` makes the project folder with the state file `.scaffold_state.yaml` and the files the template made.
:::

Chart steps

Each step shows its own data on top of the one before; one control row steps through them.

Requests per second
1 / 3

A normal morning.

Show the numbers as a table
timeapi
10:00120
10:05130
10:10125
Source: `fixtures/format/74-chart-steps.dh.md`
text
---
title: "Chart steps"
description: A sample of the chart features of format version 11.
---
## Chart steps
Each step shows its own data on top of the one before; one control row steps through them.
```chart
kind: line
title: Requests per second
x: { label: time, values: ["10:00", "10:05", "10:10"] }
series:
- name: api
data: [120, 130, 125]
steps:
- title: A normal morning.
- title: The deploy doubles the load.
series:
- name: api
data: [120, 130, 260]
- title: A worker joins.
series:
- name: worker
add: true
data: [1, 2, 3]
```

Chart time axis and annotations

A time axis in a named zone, with an event, a range and a threshold. Each marker is a button that opens a note.

Latency
Show the numbers as a table
p95
2026-11-20T10:00120 ms
2026-11-20T10:05130 ms
2026-11-20T10:10410 ms
2026-11-20T10:15150 ms
Show the annotations as a list
  • Deploy v1.4 · 2026-11-20 10:08 · Moved sessions to the new cache.
  • Incident 42 · 2026-11-20 10:09 to 10:13
  • SLO · y = 300
Source: `fixtures/format/75-chart-time-annotations.dh.md`
text
---
title: "Chart time axis and annotations"
description: A sample of the chart features of format version 11.
---
## Chart time axis and annotations
A time axis in a named zone, with an event, a range and a threshold. Each marker is a button that opens a note.
```chart
kind: line
title: Latency
x: { scale: time }
y: { label: latency, format: duration-ms }
tz: America/Los_Angeles
series:
- name: p95
data: [["2026-11-20T10:00", 120], ["2026-11-20T10:05", 130], ["2026-11-20T10:10", 410], ["2026-11-20T10:15", 150]]
annotations:
- at: 2026-11-20T10:08
label: Deploy v1.4
text: Moved sessions to the new cache.
tone: acc
- from: 2026-11-20T10:09
to: 2026-11-20T10:13
label: Incident 42
tone: bad
- y: 300
label: SLO
tone: warn
fill: above
```

Chart heatmap

A heatmap draws one cell per value; an empty cell is null.

Errors by hour
Show the numbers as a table
day \ hour000408
Mon014
Tue212
Source: `fixtures/format/76-chart-heatmap.dh.md`
text
---
title: "Chart heatmap"
description: A sample of the chart features of format version 11.
---
## Chart heatmap
A heatmap draws one cell per value; an empty cell is null.
```chart
kind: heatmap
title: Errors by hour
x: { label: hour, values: ["00", "04", "08"] }
y: { label: day, values: [Mon, Tue] }
series:
- name: errors
data:
- [0, 1, 4]
- [null, 2, 12]
```

Chart line styles and markers

Each series has its own line style and marker, and a key that shows both.

Show the numbers as a table
monthThis yearForecastLast year
Jan820760
Feb860790
Mar910910840
Apr9901,000900
Source: `fixtures/format/77-chart-line-styles.dh.md`
text
---
title: "Chart line styles and markers"
description: A sample of the chart features of format version 11.
---
## Chart line styles and markers
Each series has its own line style and marker, and a key that shows both.
```chart
kind: line
x: { label: month, values: [Jan, Feb, Mar, Apr] }
y: { label: loans }
series:
- name: This year
line: solid
marker: circle
data: [820, 860, 910, 990]
- name: Forecast
line: dashed
marker: diamond
data: [null, null, 910, 1000]
- name: Last year
line: dotted
marker: none
data: [760, 790, 840, 900]
```

Chart log and linear switch

The reader can switch the y axis between log and linear.

Axis scale
Show the numbers as a table
yearWebBatch
20201,20030
20218,10070
202261,000150
2023410,000400
Source: `fixtures/format/78-chart-log-toggle.dh.md`
text
---
title: "Chart log and linear switch"
description: A sample of the chart features of format version 11.
---
## Chart log and linear switch
The reader can switch the y axis between log and linear.
```chart
kind: line
x: { label: year, values: [2020, 2021, 2022, 2023] }
y: { label: requests, scale: log, toggle: true }
series:
- name: Web
data: [1200, 8100, 61000, 410000]
- name: Batch
data: [30, 70, 150, 400]
```

Chart calculator

The calculator layout: inputs, one row per formula and one result.

Storage bill

Inputs

GB
USD per GB

How it adds up

Storage$27.60Data stored × Price per GB × (Second copy ? 2 : 1)
Fees12 unitsData stored ÷ 100
Monthly bill$39.60Storage + Fees
Source: `fixtures/format/79-chart-calculator.dh.md`
text
---
title: "Chart calculator"
description: A sample of the chart features of format version 11.
---
## Chart calculator
The calculator layout: inputs, one row per formula and one result.
```chart
layout: calculator
title: Storage bill
controls:
- slider: stored
label: Data stored
unit: GB
min: 100
max: 5000
step: 100
value: 1200
- slider: price
label: Price per GB
unit: USD per GB
min: 0.01
max: 0.1
step: 0.001
value: 0.023
- toggle: second
label: Second copy
value: false
let:
storage: "stored * price * (second ? 2 : 1)"
fees: stored / 100
total: storage + fees
calc:
- let: storage
label: Storage
format: money
- let: fees
label: Fees
unit: units
- let: total
label: Monthly bill
format: money
result: true
```

References

A part on a line of its own is a block: the host's resolver answers for it, and without one the label shows as a chip.

chartRevenue by month, 2026

svgThe system at a glance

interactiveCompound growth, with a slider

Inside a sentence a reference is a chip: the build log is in terminalthe build, and the label is optional, as in filetreerepo-layout.

In code it is text: [[chart:revenue-2026]] stays as written, and so does a fence:

text
[[svg:logo "not a reference here"]]

A word that is not a part type is plain text too: [[note:this]] and [[1, 2]].

Source: `fixtures/format/80-references.dh.md`
text
---
title: "References"
description: Parts the host keeps, referenced by type and name; the page holds only the reference and its label.
---
## References
A part on a line of its own is a block: the host's resolver answers for it, and without one the label shows as a chip.
[[chart:revenue-2026 "Revenue by month, 2026"]]
[[svg:architecture.dark "The system at a glance"]]
[[interactive:compound-growth "Compound growth, with a slider"]]
Inside a sentence a reference is a chip: the build log is in [[terminal:build-42 "the build"]], and the label is optional, as in [[filetree:repo-layout]].
In code it is text: `[[chart:revenue-2026]]` stays as written, and so does a fence:
```text
[[svg:logo "not a reference here"]]
```
A word that is not a part type is plain text too: [[note:this]] and [[1, 2]].

Static: the same parts live and still

Any part that steps or moves can stand still. static on the fence draws the finished state, and static=2 or static="<step title>" draws that step, with no player, no control row and no motion. Printing, a page with static: true in its front matter, a host option and the reader's "reduce motion" setting use the same option. The LLM view is the same for both.

A scene

Live:

Animation, 3 steps. Starts with: person u "reader"; box web "web server"; cylinder db "database"; box log "access log". 1. The reader asks for a page. 2. The server reads the row it needs. 3. The server writes the visit to its log.

GET /readerreaderweb serverweb serverdatabasedatabaseaccess logaccess log
1The reader asks for a page.
1 / 3
All steps (3)

Static, the finished state:

Animation, 3 steps. Starts with: person u "reader"; box web "web server"; cylinder db "database"; box log "access log". 1. The reader asks for a page. 2. The server reads the row it needs. 3. The server writes the visit to its log.

GET /SELECTvisitreaderreaderweb serverweb serverdatabasedatabaseaccess logaccess log

3 The server writes the visit to its log.

All steps (3)
  1. The reader asks for a page.
  2. The server reads the row it needs.
  3. The server writes the visit to its log.

A terminal

Live:

setup
$bun add durian-hypermedia
installed durian-hypermedia
$
1 / 2

Static, every command typed:

setup
$bun add durian-hypermedia
installed durian-hypermedia
$bun test
301 pass, 0 fail
$

A file tree

Live:

ExplorerThe app starts with one file
  • api.ts
1 / 2

Static, the step named "The app starts with one file":

ExplorerThe app starts with one file
  • api.ts
Source: `fixtures/format/81-static-live-and-still.dh.md`
text
---
title: "Static: the same parts live and still"
description: The same scene, terminal and file tree twice, live and then static (SPEC 4.1); print draws every part this way.
---
## Static: the same parts live and still
Any part that steps or moves can stand still. `static` on the fence draws the finished state, and `static=2` or `static="<step title>"` draws that step, with no player, no control row and no motion. Printing, a page with `static: true` in its front matter, a host option and the reader's "reduce motion" setting use the same option. The LLM view is the same for both.
### A scene
Live:
```animation layout=graph
person u "reader"
box web "web server"
cylinder db "database"
box log "access log"
@step The reader asks for a page.
u -> web "GET /"
@step The server reads the row it needs.
web -> db "SELECT"
@step The server writes the visit to its log.
web -> log "visit"
```
Static, the finished state:
```animation layout=graph static
person u "reader"
box web "web server"
cylinder db "database"
box log "access log"
@step The reader asks for a page.
u -> web "GET /"
@step The server reads the row it needs.
web -> db "SELECT"
@step The server writes the visit to its log.
web -> log "visit"
```
### A terminal
Live:
```terminal title="setup"
$ bun add durian-hypermedia
installed durian-hypermedia
$ bun test
301 pass, 0 fail
```
Static, every command typed:
```terminal title="setup" static
$ bun add durian-hypermedia
installed durian-hypermedia
$ bun test
301 pass, 0 fail
```
### A file tree
Live:
```filetree
@step The app starts with one file
app/
api.ts
@step A parser joins it
app/
api.ts
parse.ts (new)
```
Static, the step named "The app starts with one file":
```filetree static="The app starts with one file"
@step The app starts with one file
app/
api.ts
@step A parser joins it
app/
api.ts
parse.ts (new)
```

State: a state machine that its steps walk

A state part draws a state machine from its transitions. at says where the walk is, and fire takes the one transition with that event from there.

State machine: An order. Starts at cart; ends after shipped. | from | on | to | | --- | --- | --- | | cart | check out | paying | | paying | card accepted | paid | | paying | card declined | cart | | paid | ship | shipped | - paying (Paying): waits up to 10 minutes for the bank - done (Fulfilment), a group of paid, shipped; a transition to it enters paid 1. A shopper fills the cart. at cart 2. They check out. cart -> paying (check out) 3. The bank declines the card: back to the cart. paying -> cart (card declined) 4. They try another card, and the bank takes it. at paying paying -> paid (card accepted)

An order
FulfilmentFulfilmentcheck outcard acceptedcard declinedshipstartcartcartPaying · waits up to 10 minutes for the bankPayingpaidpaidshippedshippedend
1A shopper fills the cart.
1 / 4
All steps (4)

The same machine, static (the finished walk, no player):

State machine: An order, static. Starts at cart; ends after shipped. | from | on | to | | --- | --- | --- | | cart | check out | paying | | paying | card accepted | paid | | paying | card declined | cart | | paid | ship | shipped | - paying (Paying): waits up to 10 minutes for the bank - done (Fulfilment), a group of paid, shipped; a transition to it enters paid 1. A shopper fills the cart. at cart 2. They check out. cart -> paying (check out) 3. The bank declines the card: back to the cart. paying -> cart (card declined) 4. They try another card, and the bank takes it. at paying paying -> paid (card accepted)

An order, static
FulfilmentFulfilmentcheck outcard acceptedcard declinedshipstartcartcartPaying · waits up to 10 minutes for the bankPayingpaidpaidshippedshippedendcard accepted

4 They try another card, and the bank takes it.

All steps (4)
  1. A shopper fills the cart.
  2. They check out.
  3. The bank declines the card: back to the cart.
  4. They try another card, and the bank takes it.
Source: `fixtures/format/90-state-diagram.dh.md`
text
---
title: "State: a state machine that its steps walk"
description: A state diagram drawn from its transitions; each step walks one transition (SPEC 3.2 State). Shown live, then static.
---
## State: a state machine that its steps walk
A `state` part draws a state machine from its transitions. `at` says where the walk is, and `fire` takes the one transition with that event from there.
```state title="An order"
[start] -> cart
cart -> paying "check out"
paying -> paid "card accepted"
paying -> cart "card declined"
paid -> shipped "ship"
shipped -> [end]
state paying "Paying" note="waits up to 10 minutes for the bank"
group done "Fulfilment": paid, shipped
@step A shopper fills the cart.
at cart
@step They check out.
fire check out
@step The bank declines the card: back to the cart.
fire card declined
@step They try another card, and the bank takes it.
at paying
fire card accepted
```
The same machine, static (the finished walk, no player):
```state static=true title="An order, static"
[start] -> cart
cart -> paying "check out"
paying -> paid "card accepted"
paying -> cart "card declined"
paid -> shipped "ship"
shipped -> [end]
state paying "Paying" note="waits up to 10 minutes for the bank"
group done "Fulfilment": paid, shipped
@step A shopper fills the cart.
at cart
@step They check out.
fire check out
@step The bank declines the card: back to the cart.
fire card declined
@step They try another card, and the bank takes it.
at paying
fire card accepted
```

Class: types and how they relate

A class part draws classes from their members and from relations written in words: extends, implements, owns, has, uses and ->.

Class diagram: Orders. class Order implements Payable: + id: OrderId; + total(): Money; - lines: Line[] (An order is written once, at check out.) class Line: + quantity: int interface Payable: + pay(amount: Money): Receipt abstract class Shape enum Status: open, paid, shipped Order owns 1 or more Line (composition). Order has 1 Status (aggregation). Circle extends Shape. Order uses Clock (dependency). Order placed by 1 Customer (association; each Customer has 0 or more Order).

Orders
PayableinterfacePayableOrder · An order is written once, at check out.OrderLineLineShapeShapeStatusenumStatusCircleCircleClockClockCustomerCustomer1..*10..*1placed by+ pay(amount: Money): Receipt+pay(amount: Money)Receipt+ id: OrderId+idOrderId- lines: Line[]-linesLine[]+ total(): Money+total()Money+ quantity: int+quantityintopenopenpaidpaidshippedshipped

The same diagram, static:

Class diagram: Orders, static. class Order implements Payable: + id: OrderId; + total(): Money; - lines: Line[] (An order is written once, at check out.) class Line: + quantity: int interface Payable: + pay(amount: Money): Receipt abstract class Shape enum Status: open, paid, shipped Order owns 1 or more Line (composition). Order has 1 Status (aggregation). Circle extends Shape. Order uses Clock (dependency). Order placed by 1 Customer (association; each Customer has 0 or more Order).

Orders, static
PayableinterfacePayableOrder · An order is written once, at check out.OrderLineLineShapeShapeStatusenumStatusCircleCircleClockClockCustomerCustomer1..*10..*1placed by+ pay(amount: Money): Receipt+pay(amount: Money)Receipt+ id: OrderId+idOrderId- lines: Line[]-linesLine[]+ total(): Money+total()Money+ quantity: int+quantityintopenopenpaidpaidshippedshipped
Source: `fixtures/format/91-class-diagram.dh.md`
text
---
title: "Class: types and how they relate"
description: A class diagram drawn from members and relations written in words (SPEC 3.2 Class). Shown whole, then static.
---
## Class: types and how they relate
A `class` part draws classes from their members and from relations written in words: `extends`, `implements`, `owns`, `has`, `uses` and `->`.
```class title="Orders"
class Order note="An order is written once, at check out."
+ id: OrderId
+ total(): Money
- lines: Line[]
class Line
+ quantity: int
interface Payable
+ pay(amount: Money): Receipt
abstract class Shape
enum Status: open, paid, shipped
Order implements Payable
Order owns 1..* Line
Order has 1 Status
Circle extends Shape
Order uses Clock
Order 0..* -> 1 Customer "placed by"
```
The same diagram, static:
```class static=true title="Orders, static"
class Order note="An order is written once, at check out."
+ id: OrderId
+ total(): Money
- lines: Line[]
class Line
+ quantity: int
interface Payable
+ pay(amount: Money): Receipt
abstract class Shape
enum Status: open, paid, shipped
Order implements Payable
Order owns 1..* Line
Order has 1 Status
Circle extends Shape
Order uses Clock
Order 0..* -> 1 Customer "placed by"
```

ER: tables and their keys

An er part draws tables with their keys and joins them with crow's-foot lines, each from the key to what it points at. A step may light a table or a column.

ER diagram: Shop. customer (Customer): id uuid pk; email text unique order (Order): id uuid pk; customer_id uuid fk -> customer.id; placed_at timestamptz line (Order line): order_id uuid fk -> order.id; product text; quantity int A customer places 0 or more orders; an order belongs to exactly 1 customer. An order holds 1 or more lines; a line belongs to exactly 1 order. 1. Start from the customer's key. lit: customer.id 2. Each order keeps it in `customer_id`. lit: order.customer_id 3. Each line of an order keeps the order's key in `order_id`. lit: line.order_id

Shop
CustomerCustomerOrderOrderOrder lineOrder lineplacesholdsid: uuididuuidPKemail: textemailtextuniqueid: uuididuuidPKcustomer_id: uuidcustomer_iduuidFKplaced_at: timestamptzplaced_attimestamptzorder_id: uuidorder_iduuidFKproduct: textproducttextquantity: intquantityint
1Start from the customer's key.
1 / 3
All steps (3)

The same diagram, static:

ER diagram: Shop, static. customer (Customer): id uuid pk; email text unique order (Order): id uuid pk; customer_id uuid fk -> customer.id; placed_at timestamptz line (Order line): order_id uuid fk -> order.id; product text; quantity int A customer places 0 or more orders; an order belongs to exactly 1 customer. An order holds 1 or more lines; a line belongs to exactly 1 order. 1. Start from the customer's key. lit: customer.id 2. Each order keeps it in `customer_id`. lit: order.customer_id 3. Each line of an order keeps the order's key in `order_id`. lit: line.order_id

Shop, static
CustomerCustomerOrderOrderOrder lineOrder lineplacesholdsid: uuididuuidPKemail: textemailtextuniqueid: uuididuuidPKcustomer_id: uuidcustomer_iduuidFKplaced_at: timestamptzplaced_attimestamptzorder_id: uuidorder_iduuidFKproduct: textproducttextquantity: intquantityint

3 Each line of an order keeps the order's key in order_id.

All steps (3)
  1. Start from the customer's key.
  2. Each order keeps it in customer_id.
  3. Each line of an order keeps the order's key in order_id.
Source: `fixtures/format/92-er-diagram.dh.md`
text
---
title: "ER: tables and their keys"
description: An entity-relationship diagram with crow's-foot lines from key to key (SPEC 3.2 ER). Shown live, then static.
---
## ER: tables and their keys
An `er` part draws tables with their keys and joins them with crow's-foot lines, each from the key to what it points at. A step may light a table or a column.
```er title="Shop"
entity customer "Customer" [c1]
id uuid pk
email text unique
entity order "Order" [c2]
id uuid pk
customer_id uuid fk -> customer.id
placed_at timestamptz
entity line "Order line" [c2]
order_id uuid fk -> order.id
product text
quantity int
customer 1 -- 0..* order "places"
order 1 -- 1..* line "holds"
@step Start from the customer's key.
highlight customer.id
@step Each order keeps it in `customer_id`.
highlight order.customer_id
@step Each line of an order keeps the order's key in `order_id`.
highlight line.order_id
```
The same diagram, static:
```er static=true title="Shop, static"
entity customer "Customer" [c1]
id uuid pk
email text unique
entity order "Order" [c2]
id uuid pk
customer_id uuid fk -> customer.id
placed_at timestamptz
entity line "Order line" [c2]
order_id uuid fk -> order.id
product text
quantity int
customer 1 -- 0..* order "places"
order 1 -- 1..* line "holds"
@step Start from the customer's key.
highlight customer.id
@step Each order keeps it in `customer_id`.
highlight order.customer_id
@step Each line of an order keeps the order's key in `order_id`.
highlight line.order_id
```

Animations (graph engine)

Animation: the engine

One language for every animation: a free 2D space of entities (shapes, containers, data structures, tokens), connectors that follow their ends, layouts that place things, a camera, and steps of changes that run together. The reader can step, or explore: drag to move, pinch or Ctrl + wheel to zoom, click a thing to read its note, then "Back to the story". Here, an array is sorted: swap trades two cells, highlight lights them for one step, a pointer moves.

Animation, 5 steps. Starts with: array a: 5, 2, 8, 1; pointer i at a.0. 1. Bubble sort compares neighbours. 5 and 2 are out of order. 2. So they swap: 2 now comes first. 3. It compares 5 and 8: in order, so they stay. 4. 8 and 1 are not: they swap, and 8, the biggest, has reached the end. 5. Two more passes move 1 to the front. The array is sorted.

a550221882113ii
1Bubble sort compares neighbours. 5 and 2 are out of order.
1 / 5
All steps (5)
Source: `fixtures/format/47-animation-the-engine.dh.md`
text
---
title: "Animation: the engine"
description: A fixture made from the Format page section of the same name.
---
## Animation: the engine
One language for every animation: a free 2D space of **entities** (shapes, containers, data structures, tokens), **connectors** that follow their ends, **layouts** that place things, a **camera**, and **steps** of changes that run together. The reader can step, or explore: drag to move, pinch or Ctrl + wheel to zoom, click a thing to read its note, then "Back to the story". Here, an array is sorted: `swap` trades two cells, `highlight` lights them for one step, a pointer moves.
```animation
array a: 5 2 8 1
pointer i "i" at a.0
@step Bubble sort compares neighbours. 5 and 2 are out of order.
highlight a.0 a.1
@step So they swap: 2 now comes first.
swap a.0 a.1
@step It compares 5 and 8: in order, so they stay.
move i to a.1
highlight a.1 a.2
@step 8 and 1 are not: they swap, and 8, the biggest, has reached the end.
move i to a.2
swap a.2 a.3
set a.3 tone=good
@step Two more passes move 1 to the front. The array is sorted.
swap a.1 a.2
swap a.0 a.1
set a.0 tone=good
set a.1 tone=good
set a.2 tone=good
remove i
```

Animation: binary search tree insert

A tree lays out its nodes; under n3 right puts a node on a side. A token walks down, and the camera moves in for the insert.

Animation, 4 steps. Starts with: tree t [circle n8 "8", circle n3 "3" under n8 left, circle n10 "10" under n8 right, circle n1 "1" under n3 left, circle n14 "14" under n10 right]. 1. Insert 6. Start at the root: 6 is less than 8, so go left. 2. 6 is more than 3, so go right. n8 -> n3: 6 3. 3 has no right child: 6 goes there. 4. The order holds: everything left of a node is smaller, everything right of it is bigger.

t8833101011141466
1Insert 6. Start at the root: 6 is less than 8, so go left.
1 / 4
All steps (4)
Source: `fixtures/format/48-animation-binary-search-tree-insert.dh.md`
text
---
title: "Animation: binary search tree insert"
description: A fixture made from the Format page section of the same name.
---
## Animation: binary search tree insert
A `tree` lays out its nodes; `under n3 right` puts a node on a side. A token walks down, and the camera moves in for the insert.
```animation
tree t
circle n8 "8" in t
circle n3 "3" in t under n8 left
circle n10 "10" in t under n8 right
circle n1 "1" in t under n3 left
circle n14 "14" in t under n10 right
@step Insert 6. Start at the root: 6 is less than 8, so go left.
add token k "6" at n8
highlight n8
@step 6 is more than 3, so go right.
move k to n3
highlight n3
@step 3 has no right child: 6 goes there.
add circle n6 "6" in t under n3 right
remove k
set n6 tone=good
camera n3
@step The order holds: everything left of a node is smaller, everything right of it is bigger.
camera all
```

Animation: hash table with a collision

buckets makes a hash table's buckets; two keys in one bucket make a chain. send moves a token along a path.

Animation, 5 steps. Starts with: buckets h "hash table" (5). 1. hash("apple") mod 5 is 2, so apple goes in bucket 2. 2. hash("kiwi") mod 5 is 4; bucket 4 is empty. 3. hash("grape") mod 5 is also 2: a collision. 4. The bucket keeps a chain. Finding grape starts at bucket 2, which leads to apple. h.2 -> apple: find grape 5. apple is not grape, so the search follows the chain one more link, to grape. apple -> grape: find grape

hash tablehash table0011223344appleapple
1hash("apple") mod 5 is 2, so apple goes in bucket 2.
1 / 5
All steps (5)
Source: `fixtures/format/49-animation-hash-table-with-a-collision.dh.md`
text
---
title: "Animation: hash table with a collision"
description: A fixture made from the Format page section of the same name.
---
## Animation: hash table with a collision
`buckets` makes a hash table's buckets; two keys in one bucket make a chain. `send` moves a token along a path.
```animation
buckets h "hash table" count=5
@step hash("apple") mod 5 is 2, so apple goes in bucket 2.
add pill apple "apple" in h.2
highlight h.2
@step hash("kiwi") mod 5 is 4; bucket 4 is empty.
add pill kiwi "kiwi" in h.4
@step hash("grape") mod 5 is also 2: a collision.
add pill grape "grape" in h.2
highlight apple grape tone=warn
say h.2: two keys, one bucket
@step The bucket keeps a chain. Finding grape starts at bucket 2, which leads to apple.
send "find grape" h.2 -> apple
camera h.2 close
@step apple is not grape, so the search follows the chain one more link, to grape.
send "find grape" apple -> grape
```

Animation: sharding, then rebalancing

Shards are containers holding key ranges; move puts a range in another shard, and its connectors follow.

Animation, 4 steps. Starts with: pill router; group s1 "shard 1" [pill k1 "users 1–100", pill k2 "users 101–200"]; group s2 "shard 2" [pill k3 "users 201–300", pill k4 "users 301–400"]. Connected: router -> s1, router -> s2. 1. The router sends each request to the shard that holds the user's key range. router -> s2: user 250 2. Shard 2 is getting full. A third shard joins, empty. 3. Rebalance: the range 301–400 moves to shard 3. 4. The router's map changes with it: user 350 now goes to shard 3. router -> s3: user 350

shard 1shard 1shard 2shard 2router · maps each key range to a shardrouterusers 1–100users 1–100users 101–200users 101–200users 201–300users 201–300users 301–400users 301–400user 250
1The router sends each request to the shard that holds the user's key range.
1 / 4
All steps (4)
Source: `fixtures/format/50-animation-sharding-then-rebalancing.dh.md`
text
---
title: "Animation: sharding, then rebalancing"
description: A fixture made from the Format page section of the same name.
---
## Animation: sharding, then rebalancing
Shards are containers holding key ranges; `move` puts a range in another shard, and its connectors follow.
```animation
pill router "router"
group s1 "shard 1" layout=column
group s2 "shard 2" layout=column
pill k1 "users 1–100" in s1
pill k2 "users 101–200" in s1
pill k3 "users 201–300" in s2
pill k4 "users 301–400" in s2
router -> s1
router -> s2
note router: maps each key range to a shard
@step The router sends each request to the shard that holds the user's key range.
send "user 250" router -> s2
@step Shard 2 is getting full. A third shard joins, empty.
add group s3 "shard 3" layout=column
router -> s3
set s2 tone=warn
@step Rebalance: the range 301–400 moves to shard 3.
move k4 to s3
set s2 tone=plain
@step The router's map changes with it: user 350 now goes to shard 3.
send "user 350" router -> s3
```

Animation: replicas and failover

set d1 down=yes takes the primary down; move d2 to pg promotes a replica into the primary's place, and the connectors change with it.

Animation, 6 steps. Starts with: pill app; group pg "primary" [cylinder d1 "db-1"]; group rg "replicas" [cylinder d2 "db-2", cylinder d3 "db-3"]. Connected: app -> d1 "writes", d1 --> d2 "copies", d1 --> d3 "copies". Families, one colour each: app "the app" (app, app -> d1); db "databases" (d1, d2, d3); copy "copying" (d1 -> d2, d1 -> d3). 1. The app writes to the primary. app -> d1: write 2. The primary copies the write to both replicas. d1 -> d2: copy d1 -> d3: copy 3. The primary's machine dies, so it can take no more writes. 4. db-2 has the newest copy, so it is promoted: it moves to the primary's place, and the app writes to it. 5. The dead one is taken out, and the app writes to the new primary. app -> d2: write 6. db-3 now copies from the new primary. d2 -> d3: copy

  • the app
  • databases
  • copying
primaryprimaryreplicasreplicaswritescopiescopiesappappdb-1db-1db-2db-2db-3db-3write
1The app writes to the primary.
1 / 6
All steps (6)
Source: `fixtures/format/51-animation-replicas-and-failover.dh.md`
text
---
title: "Animation: replicas and failover"
description: A fixture made from the Format page section of the same name.
---
## Animation: replicas and failover
`set d1 down=yes` takes the primary down; `move d2 to pg` promotes a replica into the primary's place, and the connectors change with it.
```animation
family app "the app"
family db "databases"
family copy "copying"
pill app "app" is=app
group pg "primary" layout=column
cylinder d1 "db-1" in pg is=db
group rg "replicas" layout=column
cylinder d2 "db-2" in rg is=db
cylinder d3 "db-3" in rg is=db
app -> d1 "writes" is=app
d1 --> d2 "copies" is=copy
d1 --> d3 "copies" is=copy
@step The app writes to the primary.
send "write" app -> d1
@step The primary copies the write to both replicas.
send "copy" d1 -> d2 is=copy
send "copy" d1 -> d3 is=copy
@step The primary's machine dies, so it can take no more writes.
set d1 down=yes
say d1: no heartbeat
@step db-2 has the newest copy, so it is promoted: it moves to the primary's place, and the app writes to it.
move d2 to pg
remove app -> d1
app -> d2 "writes" is=app
@step The dead one is taken out, and the app writes to the new primary.
remove d1
d2 --> d3 "copies" is=copy
send "write" app -> d2
@step db-3 now copies from the new primary.
send "copy" d2 -> d3 is=copy
```

Animation: pods, nodes, a service

Containers nest: pods in nodes in a cluster. A service is a stable name in front of pods; when a node dies, a pod is started elsewhere.

Animation, 5 steps. Starts with: group cluster [group n1 "node 1" [pill w1 "web-1", pill c1 "cache-1"], group n2 "node 2" [pill w2 "web-2"], group n3 "node 3" [pill w3 "web-3"]]; pill svc "service: web". Connected: svc -> w1, svc -> w2, svc -> w3. Families, one colour each: svc "service" (svc, svc -> w1, svc -> w2, svc -> w3); web "web pods" (w1, w2, w3); cache "cache pods" (c1). 1. Pods run on nodes; nodes make up the cluster. The service is one name in front of the three web pods. 2. Calls to the service are spread over its pods: rules on every node pick one. svc -> w1: GET / svc -> w2: GET /cart 3. Node 2 dies, and web-2 with it. 4. The scheduler starts a new web-2 on node 3, which has room. 5. The rules now pick among the running pods only; nobody sees a gap. svc -> w2b: GET /cart

  • service
  • web pods
  • cache pods
clusterclusternode 1node 1node 2node 2node 3node 3web-1web-1cache-1cache-1web-2web-2web-3web-3service: web · one stable name and address in front of the web podsservice: web
1Pods run on nodes; nodes make up the cluster. The service is one name in front of the three web pods.
1 / 5
All steps (5)
Source: `fixtures/format/52-animation-pods-nodes-a-service.dh.md`
text
---
title: "Animation: pods, nodes, a service"
description: A fixture made from the Format page section of the same name.
---
## Animation: pods, nodes, a service
Containers nest: pods in nodes in a cluster. A service is a stable name in front of pods; when a node dies, a pod is started elsewhere.
```animation dir=down
family svc "service"
family web "web pods"
family cache "cache pods"
group cluster "cluster" layout=row
group n1 "node 1" in cluster
group n2 "node 2" in cluster
group n3 "node 3" in cluster
pill w1 "web-1" in n1 is=web
pill c1 "cache-1" in n1 is=cache
pill w2 "web-2" in n2 is=web
pill w3 "web-3" in n3 is=web
pill svc "service: web" is=svc
svc -> w1 is=svc
svc -> w2 is=svc
svc -> w3 is=svc
note svc: one stable name and address in front of the web pods
@step Pods run on nodes; nodes make up the cluster. The service is one name in front of the three web pods.
camera all
@step Calls to the service are spread over its pods: rules on every node pick one.
send "GET /" svc -> w1
send "GET /cart" svc -> w2
@step Node 2 dies, and web-2 with it.
set n2 down=yes
set w2 down=yes
camera cluster
@step The scheduler starts a new web-2 on node 3, which has room.
remove w2
add pill w2b "web-2" in n3 is=web
svc -> w2b is=svc
@step The rules now pick among the running pods only; nobody sees a gap.
send "GET /cart" svc -> w2b
camera all
```

Animation: a service mesh

Each pod holds its app and a sidecar proxy, on two nodes with the network under them; the control plane, a pod of its own on node 1, pushes config to the proxies. A send shows its movement as a small token (the default), as an arrow that draws itself from source to target (send arrow), or both (send both); an LLM reads each the same way, as a -> b: label under the step. family app "apps" names a family in the setup and is=app gives a thing, a connector or a send its colour: each family gets one colour from a fixed palette (a soft fill, a line, an ink for words), the same on every shape, arrow, token and chip, in light and dark, with a legend above the stage. A send takes the colour of the thing it starts from.

Animation, 13 steps, flat. Node 1 (the control plane's mesh config; pod orders: the orders app and its proxy; node 1's network card), the network under the cluster, node 2 (pod payments: its proxy and the payments app; node 2's network card). 1. to 6. The orders app calls its own proxy; the proxy encrypts the call with mutual TLS and sends it out of node 1's card, across the network, into node 2's card, to the payments proxy, which decrypts it and hands it to its app. 7. The control plane pushes "retry twice" to the orders proxy. No app changes. 8. A call fails once at the payments app. 9. to 13. The orders proxy retries by itself on the same path; the payments app takes the second try.

  • apps
  • sidecar proxies
  • network cards and the network
  • control plane
node 1 · node IP 198.51.100.21node 1node 2 · node IP 198.51.100.22node 2control planecontrol planepod: orderspod: orderspod: paymentspod: paymentsmesh config · holds the mesh's rules and pushes them to the proxies; it runs in a pod of its own, here on node 1mesh configorders apporders appproxy · the orders pod's sidecar; pod IP 198.51.100.4proxynetwork card · eth0, node 1's network cardnetwork cardthe network · the network under the cluster: it carries the bytes from node to node and only ever sees them encryptedthe networknetwork card · eth0, node 2's network cardnetwork cardproxy · the payments pod's sidecar; pod IP 198.51.100.7proxypayments apppayments app
1Each pod runs its app and a sidecar proxy. The app talks only to its own proxy: pay order 7.
1 / 13
All steps (13)
Source: `fixtures/format/53-animation-a-service-mesh.dh.md`
text
---
title: "Animation: a service mesh"
description: A fixture made from the Format page section of the same name.
---
## Animation: a service mesh
Each pod holds its app and a sidecar proxy, on two nodes with the network under them; the control plane, a pod of its own on node 1, pushes config to the proxies. A `send` shows its movement as a small token (the default), as an arrow that draws itself from source to target (`send arrow`), or both (`send both`); an LLM reads each the same way, as `a -> b: label` under the step. `family app "apps"` names a family in the setup and `is=app` gives a thing, a connector or a send its colour: each family gets one colour from a fixed palette (a soft fill, a line, an ink for words), the same on every shape, arrow, token and chip, in light and dark, with a legend above the stage. A send takes the colour of the thing it starts from.
```animation layout=row
family app "apps"
family proxy "sidecar proxies"
family net "network cards and the network"
family ctl "control plane"
group n1 "node 1" layout=column note="node IP 198.51.100.21"
group cp "control plane" in n1 is=ctl
box cfg "mesh config" in cp is=ctl note="holds the mesh's rules and pushes them to the proxies; it runs in a pod of its own, here on node 1"
group pa "pod: orders" in n1 layout=row
box a "orders app" in pa is=app
box pxa "proxy" in pa is=proxy note="the orders pod's sidecar; pod IP 198.51.100.4"
box e1 "network card" in n1 is=net note="eth0, node 1's network card"
box net "the network" is=net note="the network under the cluster: it carries the bytes from node to node and only ever sees them encrypted"
group n2 "node 2" layout=column note="node IP 198.51.100.22"
box e2 "network card" in n2 is=net note="eth0, node 2's network card"
group pb "pod: payments" in n2 layout=row
box pxb "proxy" in pb is=proxy note="the payments pod's sidecar; pod IP 198.51.100.7"
box b "payments app" in pb is=app
e1 -> net
net -> e2
@step Each pod runs its app and a sidecar proxy. The app talks only to its own proxy: pay order 7.
send both a -> pxa
@step The orders proxy encrypts the call with mutual TLS and sends it from its pod's IP, out through node 1's network card.
send both "encrypted" pxa -> e1
@step The network under the cluster carries the encrypted bytes toward node 2. It cannot read them.
send "encrypted" e1 -> net
@step It delivers them to node 2's network card.
send net -> e2
@step Node 2 hands them to the payments proxy, which decrypts the call. Each side has proved who it is.
send both "pay order 7" e2 -> pxb
@step The payments proxy hands "pay order 7" to its app. Neither app sees the encryption.
send both pxb -> b
@step The control plane pushes a new rule to the orders proxy: retry twice. No app changes.
send arrow "retry: 2" cfg -> pxa
say pxa: retries twice on failure
@step A call fails once at the payments app.
highlight b tone=hot
say b: failed once
@step The orders proxy retries by itself, out through node 1's card again.
send both "retry" pxa -> e1
@step Across the network, still encrypted.
send "retry" e1 -> net
@step Into node 2's card.
send "retry" net -> e2
@step To the payments proxy, which decrypts it.
send e2 -> pxb
@step This time the payments app takes the call.
send both pxb -> b
```
:::llm
Animation, 13 steps, flat. Node 1 (the control plane's mesh config; pod orders: the orders app and its proxy; node 1's network card), the network under the cluster, node 2 (pod payments: its proxy and the payments app; node 2's network card).
1. to 6. The orders app calls its own proxy; the proxy encrypts the call with mutual TLS and sends it out of node 1's card, across the network, into node 2's card, to the payments proxy, which decrypts it and hands it to its app.
7. The control plane pushes "retry twice" to the orders proxy. No app changes.
8. A call fails once at the payments app.
9. to 13. The orders proxy retries by itself on the same path; the payments app takes the second try.
:::

Animation: not only code

The same entities tell any story: how a bill becomes a law (in the United States, simplified).

Animation, 5 steps. Starts with: person rep "member of the House"; group house "House"; group senate "Senate"; person pres "President"; box law; token bill at rep. Connected: rep -> house, house -> senate, senate -> pres, pres -> law. 1. A member of the House writes a bill and introduces it. 2. A House committee studies it; then the whole House votes, and a majority passes it. rep -> house: bill 3. The Senate does the same: its own committee, its own vote. house -> senate: bill 4. The President signs it. senate -> pres: bill 5. The bill is now a law. pres -> law: bill

HouseHouseSenateSenatemember of the Housemember of the HousePresidentPresidentlawlawbillbill
1A member of the House writes a bill and introduces it.
1 / 5
All steps (5)
Source: `fixtures/format/54-animation-not-only-code.dh.md`
text
---
title: "Animation: not only code"
description: A fixture made from the Format page section of the same name.
---
## Animation: not only code
The same entities tell any story: how a bill becomes a law (in the United States, simplified).
```animation dir=down
person rep "member of the House"
group house "House"
group senate "Senate"
person pres "President"
box law "law"
rep -> house
house -> senate
senate -> pres
pres -> law
token bill "bill" at rep
@step A member of the House writes a bill and introduces it.
highlight rep
@step A House committee studies it; then the whole House votes, and a majority passes it.
move bill to house
add pill hc "committee" in house
add pill hv "vote: passed" in house tone=good
@step The Senate does the same: its own committee, its own vote.
move bill to senate
add pill sc "committee" in senate
add pill sv "vote: passed" in senate tone=good
@step The President signs it.
move bill to pres
say pres: signed
@step The bill is now a law.
move bill to law
set law tone=good
```

Animation: colour families, the way a diagram uses them

Colour marks what a thing is, and words stay readable: a family's colour goes on the border, the lines and the dots, with a light tint inside (fill=soft, the default) or none (fill=none, the border only); the words are always in ink. A container can be one family and hold things of other families: each keeps its own colour. A thing of the same family as its container drops the tint, so it stands out. Set fill= on one thing, or on the whole scene (```animation fill=none). Here, letters go from post boxes (border only) through a sorting centre (one family) whose two machines are two other families.

Animation, 6 steps. Starts with: group boxes "post boxes" [box p1 "Hill Road", box p2 "Lake Street", box p3 "Market Square"]; group c1 "north centre" [box c1a "machine A", box c1b "machine B"]; group c2 "south centre" [box c2a "machine A", box c2b "machine B"]; group vans [box v1 "van 1", box v2 "van 2"]; cylinder po "post office". Connected: p1 --> c1, p2 --> c1, p3 --> c2, c1 --> v1, c2 --> v2, v1 --> po, v2 --> po. Families, one colour each: box "post boxes" (p1, p2, p3, p1 -> c1, p2 -> c1, p3 -> c2); sort "sorting centres" (c1, c2, c1 -> v1, c2 -> v2); a "machine A" (c1a, c2a); b "machine B" (c1b, c2b); van "vans" (vans, v1, v2, po, v1 -> po, v2 -> po). 1. Letters wait in three post boxes. The colours say what each thing is; the words stay in ink. 2. A collection takes the Hill Road letters to the north centre. p1 -> c1: letters 3. Machine A reads the addresses. Machine B, another family inside the same centre, stands by. 4. Machine A breaks down, and machine B takes over. 5. The sorted letters go out to van 1. c1 -> v1: sorted 6. Van 1 takes them to the post office. v1 -> po: delivery

  • post boxes
  • sorting centres
  • machine A
  • machine B
  • vans
post boxespost boxesnorth centrenorth centresouth centresouth centrevansvansHill RoadHill RoadLake StreetLake StreetMarket SquareMarket Squaremachine Amachine Amachine Bmachine Bmachine Amachine Amachine Bmachine Bvan 1van 1van 2van 2post officepost office
1Letters wait in three post boxes. The colours say what each thing is; the words stay in ink.
1 / 6
All steps (6)
Source: `fixtures/format/55-animation-colour-families-the-way-a-diagram-uses-them.dh.md`
text
---
title: "Animation: colour families, the way a diagram uses them"
description: A fixture made from the Format page section of the same name.
---
## Animation: colour families, the way a diagram uses them
Colour marks what a thing *is*, and words stay readable: a family's colour goes on the border, the lines and the dots, with a light tint inside (`fill=soft`, the default) or none (`fill=none`, the border only); the words are always in ink. A container can be one family and hold things of other families: each keeps its own colour. A thing of the same family as its container drops the tint, so it stands out. Set `fill=` on one thing, or on the whole scene (`` ```animation fill=none ``). Here, letters go from post boxes (border only) through a sorting centre (one family) whose two machines are two other families.
```animation
family box "post boxes"
family sort "sorting centres"
family a "machine A"
family b "machine B"
family van "vans"
group boxes "post boxes" layout=column
box p1 "Hill Road" in boxes is=box fill=none
box p2 "Lake Street" in boxes is=box fill=none
box p3 "Market Square" in boxes is=box fill=none
group c1 "north centre" layout=row is=sort
box c1a "machine A" in c1 is=a size=s
box c1b "machine B" in c1 is=b size=s
group c2 "south centre" layout=row is=sort
box c2a "machine A" in c2 is=a size=s
box c2b "machine B" in c2 is=b size=s
group vans "vans" layout=column is=van
box v1 "van 1" in vans is=van
box v2 "van 2" in vans is=van
cylinder po "post office" is=van
p1 --> c1 is=box
p2 --> c1 is=box
p3 --> c2 is=box
c1 --> v1 is=sort
c2 --> v2 is=sort
v1 --> po is=van
v2 --> po is=van
@step Letters wait in three post boxes. The colours say what each thing is; the words stay in ink.
@step A collection takes the Hill Road letters to the north centre.
send "letters" p1 -> c1
@step Machine A reads the addresses. Machine B, another family inside the same centre, stands by.
highlight c1a
set c1b dim=yes
@step Machine A breaks down, and machine B takes over.
set c1a down=yes
set c1b dim=no
highlight c1b tone=good
@step The sorted letters go out to van 1.
send arrow "sorted" c1 -> v1
@step Van 1 takes them to the post office.
send both "delivery" v1 -> po
```

Animation: eight colours, told apart by everyone

A scene can name up to eight families, and any two of them can stand side by side, so the eight colours are chosen by measurement, not by taste alone. Every pair differs in its border and in its fill, with normal sight and with the two common kinds of colour blindness (red-blind and green-blind, protanopia and deuteranopia, simulated). Every border is at least 3:1 against the stage and against any container it sits in; every word is at least 4.5:1 against what it sits on. A family has one fill for its boxes and its groups alike, and every border is at least 3:1 on any other family's fill, so a box of one family inside a group of another is still easy to see (one measured exception in light: the yellow family's olive border is 2.5:1 on the lilac, pink and green fills, where its own yellow fill marks its edge too). In dark a family writes its words in a light tint of its own colour. Light and dark each have their own eight, measured on their own backgrounds. Here all eight families share one scene, in two steps: one region (the services' family) holds things of four other families, and a worker of a fifth reads its queue from outside.

Animation, 2 steps. Starts with: person u "reader"; box cdn "CDN"; group region "one region" [box w1 "web", box s1 "orders service", box q1 "orders queue", cylinder db "orders DB", box c1 "cache"]; box k1 "worker". Connected: u -> cdn, cdn -> w1, w1 -> s1, s1 -> q1, q1 -> k1, k1 -> db, s1 -> c1. Families, one colour each: user "people" (u, u -> cdn); edge "the edge" (cdn, cdn -> w1); web "web servers" (w1, w1 -> s1); api "services" (region, s1, s1 -> q1, s1 -> c1); queue "queues" (q1, q1 -> k1); worker "workers" (k1, k1 -> db); store "databases" (db); cache "caches" (c1). 1. Eight families on one stage: each has its own border and its own fill. 2. The services' region holds four other families; the worker of a fifth reads its queue from outside.

  • people
  • the edge
  • web servers
  • services
  • queues
  • workers
  • databases
  • caches
one regionone regionreaderreaderCDNCDNwebweborders serviceorders serviceorders queueorders queueorders DBorders DBcachecacheworkerworker
1Eight families on one stage: each has its own border and its own fill.
1 / 2
All steps (2)

Which colour a family gets is the theme's business: the source names families and roles, never a colour value. A host restyles the palette with the tokens --c1 to --c8 (border and lines), --c1-soft (the fill of its boxes and groups alike; --c1-plane names the same colour) and --c1-ink (words in the family's colour), and the stage's own edges with --scn-edge, --scn-frame-edge and --scn-band-edge.

Source: `fixtures/format/55a-animation-eight-colours-told-apart-by-everyone.dh.md`
text
---
title: "Animation: eight colours, told apart by everyone"
description: A fixture made from the Format page section of the same name.
---
## Animation: eight colours, told apart by everyone
A scene can name up to eight families, and any two of them can stand side by side, so the eight colours are chosen by measurement, not by taste alone. Every pair differs in its **border** and in its **fill**, with normal sight and with the two common kinds of colour blindness (red-blind and green-blind, protanopia and deuteranopia, simulated). Every border is at least 3:1 against the stage and against any container it sits in; every word is at least 4.5:1 against what it sits on. A family has one fill for its boxes and its groups alike, and every border is at least 3:1 on any other family's fill, so a box of one family inside a group of another is still easy to see (one measured exception in light: the yellow family's olive border is 2.5:1 on the lilac, pink and green fills, where its own yellow fill marks its edge too). In dark a family writes its words in a light tint of its own colour. Light and dark each have their own eight, measured on their own backgrounds. Here all eight families share one scene, in two steps: one region (the services' family) holds things of four other families, and a worker of a fifth reads its queue from outside.
```animation
family user "people"
family edge "the edge"
family web "web servers"
family api "services"
family queue "queues"
family worker "workers"
family store "databases"
family cache "caches"
person u "reader" is=user
box cdn "CDN" is=edge
group region "one region" layout=row is=api
box w1 "web" in region is=web
box s1 "orders service" in region is=api
box q1 "orders queue" in region is=queue
box k1 "worker" is=worker
cylinder db "orders DB" in region is=store
box c1 "cache" in region is=cache
u -> cdn is=user
cdn -> w1 is=edge
w1 -> s1 is=web
s1 -> q1 is=api
q1 -> k1 is=queue
k1 -> db is=worker
s1 -> c1 is=api
@step Eight families on one stage: each has its own border and its own fill.
@step The services' region holds four other families; the worker of a fifth reads its queue from outside.
```
Which colour a family gets is the theme's business: the source names families and roles, never a colour value. A host restyles the palette with the tokens `--c1` to `--c8` (border and lines), `--c1-soft` (the fill of its boxes and groups alike; `--c1-plane` names the same colour) and `--c1-ink` (words in the family's colour), and the stage's own edges with `--scn-edge`, `--scn-frame-edge` and `--scn-band-edge`.

Animation: streams, meters and colours

A send stream keeps small dots flowing along a path for the whole step: traffic, a feed, readings. level=0..100 puts a meter in a thing, and set x level= moves it. Here, weather stations stream readings to a hub, which batches them into a store; the hub's buffer fills and empties.

Animation, 4 steps. Starts with: group field "stations" [box s1 "hill station", box s2 "lake station", box s3 "city station"]; box hub; cylinder db "readings store". Connected: s1 -> hub, s2 -> hub, s3 -> hub, hub -> db. Families, one colour each: st "stations" (s1, s2, s3); hub "the hub" (hub); store "the store" (db). 1. Three stations send a reading every few seconds. The hub keeps them in a buffer. s1 -> hub s2 -> hub s3 -> hub 2. A storm: the hill station sends ten times as often, and the buffer fills. s1 -> hub: storm: every second s2 -> hub s3 -> hub 3. The buffer is full: the hub writes one batch to the store and empties. hub -> db: batch of 600 4. Readings keep coming. When the buffer is full again, the next batch goes in: the store grows by a batch at a time. s1 -> hub s2 -> hub s3 -> hub hub -> db: next batch

  • stations
  • the hub
  • the store
stationsstationshill stationhill stationlake stationlake stationcity stationcity stationhub · keeps readings until it has a full batchhubreadings store · its meter: how full it isreadings store
1Three stations send a reading every few seconds. The hub keeps them in a buffer.
1 / 4
All steps (4)
Source: `fixtures/format/56-animation-streams-meters-and-colours.dh.md`
text
---
title: "Animation: streams, meters and colours"
description: A fixture made from the Format page section of the same name.
---
## Animation: streams, meters and colours
A `send stream` keeps small dots flowing along a path for the whole step: traffic, a feed, readings. `level=0..100` puts a meter in a thing, and `set x level=` moves it. Here, weather stations stream readings to a hub, which batches them into a store; the hub's buffer fills and empties.
```animation
family st "stations"
family hub "the hub"
family store "the store"
group field "stations" layout=column
box s1 "hill station" in field is=st
box s2 "lake station" in field is=st
box s3 "city station" in field is=st
box hub "hub" is=hub level=10 note="keeps readings until it has a full batch"
cylinder db "readings store" is=store level=20 note="its meter: how full it is"
s1 -> hub
s2 -> hub
s3 -> hub
hub -> db
@step Three stations send a reading every few seconds. The hub keeps them in a buffer.
send stream s1 -> hub
send stream s2 -> hub
send stream s3 -> hub
set hub level=45
@step A storm: the hill station sends ten times as often, and the buffer fills.
send stream "storm: every second" s1 -> hub
send stream s2 -> hub
send stream s3 -> hub
set hub level=90 tone=warn
@step The buffer is full: the hub writes one batch to the store and empties.
send arrow "batch of 600" hub -> db
set hub level=5 tone=plain
set db level=40
@step Readings keep coming. When the buffer is full again, the next batch goes in: the store grows by a batch at a time.
send stream s1 -> hub
send stream s2 -> hub
send stream s3 -> hub
set hub level=90
then
send arrow "next batch" hub -> db
set hub level=5
set db level=60
```

Animation: a balancer evens out the load

Meters on several things show a balance changing step by step. Here, a kitchen's three cooks get orders; a pass moves orders from the busiest cook to the least busy one.

Animation, 4 steps. Starts with: box pass "the pass"; group line "the line" [box c1 "grill", box c2 "salads", box c3 "pasta"]. Connected: pass -> c1, pass -> c2, pass -> c3. Families, one colour each: pass "the pass" (pass); cook "cooks" (c1, c2, c3). 1. Orders pile up at the grill; the salad cook is nearly idle. 2. The pass sends the next two orders to the salad cook instead. pass -> c2: 2 orders 3. The grill finishes what it had, and gets nothing new until it catches up. 4. The load is even: the three cooks now have about the same amount of work.

  • the pass
  • cooks
the linethe linethe pass · the counter where orders are handed outthe passgrillgrillsaladssaladspastapasta
1Orders pile up at the grill; the salad cook is nearly idle.
1 / 4
All steps (4)
Source: `fixtures/format/57-animation-a-balancer-evens-out-the-load.dh.md`
text
---
title: "Animation: a balancer evens out the load"
description: A fixture made from the Format page section of the same name.
---
## Animation: a balancer evens out the load
Meters on several things show a balance changing step by step. Here, a kitchen's three cooks get orders; a pass moves orders from the busiest cook to the least busy one.
```animation dir=down
family pass "the pass"
family cook "cooks"
box pass "the pass" is=pass note="the counter where orders are handed out"
group line "the line" layout=row
box c1 "grill" in line is=cook level=90
box c2 "salads" in line is=cook level=20
box c3 "pasta" in line is=cook level=40
pass -> c1
pass -> c2
pass -> c3
@step Orders pile up at the grill; the salad cook is nearly idle.
highlight c1 tone=hot
@step The pass sends the next two orders to the salad cook instead.
send both "2 orders" pass -> c2
set c2 level=45
@step The grill finishes what it had, and gets nothing new until it catches up.
set c1 level=60
@step The load is even: the three cooks now have about the same amount of work.
set c1 level=50
set c3 level=45
highlight c1 c2 c3 tone=good
```

Animation: one question becomes three

split and merge with arrows show one request fanning out and coming back together. Here, a library search asks three branch catalogues at once and merges their answers.

Animation, 4 steps. Starts with: pill ask "find: tide tables"; box planner; group branches [cylinder b1 "north branch", cylinder b2 "harbour branch", cylinder b3 "old town branch"]; box merge "merger". Connected: ask -> planner, planner -> b1, planner -> b2, planner -> b3, b1 -> merge, b2 -> merge, b3 -> merge. Families, one colour each: q "the question" (ask, planner, merge); br "branch catalogues" (b1, b2, b3). 1. A reader asks for tide tables. The planner sees that three branches keep them. ask -> planner 2. The planner asks all three branches at once. planner -> b1: same question planner -> b2 planner -> b3 3. Each branch answers with what it has; the old town branch has nothing. b1 -> merge: 2 books b2 -> merge: 5 books 4. The merger joins the answers into one list for the reader.

  • the question
  • branch catalogues
branchesbranchesfind: tide tablesfind: tide tablesplanner · splits a search by branchplannernorth branchnorth branchharbour branchharbour branchold town branchold town branchmergermerger
1A reader asks for tide tables. The planner sees that three branches keep them.
1 / 4
All steps (4)
Source: `fixtures/format/58-animation-one-question-becomes-three.dh.md`
text
---
title: "Animation: one question becomes three"
description: A fixture made from the Format page section of the same name.
---
## Animation: one question becomes three
`split` and `merge` with arrows show one request fanning out and coming back together. Here, a library search asks three branch catalogues at once and merges their answers.
```animation
family q "the question"
family br "branch catalogues"
pill ask "find: tide tables" is=q
box planner "planner" is=q note="splits a search by branch"
group branches "branches" layout=column
cylinder b1 "north branch" in branches is=br
cylinder b2 "harbour branch" in branches is=br
cylinder b3 "old town branch" in branches is=br
box merge "merger" is=q
ask -> planner
planner -> b1
planner -> b2
planner -> b3
b1 -> merge
b2 -> merge
b3 -> merge
@step A reader asks for tide tables. The planner sees that three branches keep them.
send arrow ask -> planner
@step The planner asks all three branches at once.
send arrow "same question" planner -> b1
send arrow planner -> b2
send arrow planner -> b3
@step Each branch answers with what it has; the old town branch has nothing.
send both "2 books" b1 -> merge
send both "5 books" b2 -> merge
set b3 dim=yes
@step The merger joins the answers into one list for the reader.
highlight merge
say merge below: 7 books, by date
```

Animation: the author sets the beat

Format version 9 gives the author more say over motion, still with no times or pixels. then starts the next beat of a step: what comes after it waits for what came before. pace slow or pace fast sets a step's speed. spotlight dims everything else for one step. say cache below: … says where the speech goes. path=arc makes a move travel over an arc. Things a step does not change never move.

Animation, 4 steps. Starts with: person u "reader"; group app "web app" [box h "handler"]; box cache; cylinder db "database"; group tray "pages ready". Connected: u -> app, app -> cache, app -> db. Families, one colour each: app "the app" (app, h); data (cache, db). 1. A reader asks the web app for a page. u -> app: GET /a 2. The app looks in the cache; then the cache answers. app -> cache: find /a 3. So the app reads the database. The pace is slow, so the wait shows. app -> db: read /a 4. The handler builds the page; then it moves over to the pages that are ready.

  • the app
  • data
web appweb apppages readypages readyreaderreaderhandlerhandlercachecachedatabasedatabaseGET /a
1A reader asks the web app for a page.
1 / 4
All steps (4)
Source: `fixtures/format/59-animation-the-author-sets-the-beat.dh.md`
text
---
title: "Animation: the author sets the beat"
description: A fixture made from the Format page section of the same name.
---
## Animation: the author sets the beat
Format version 9 gives the author more say over motion, still with no times or pixels. `then` starts the next beat of a step: what comes after it waits for what came before. `pace slow` or `pace fast` sets a step's speed. `spotlight` dims everything else for one step. `say cache below: …` says where the speech goes. `path=arc` makes a move travel over an arc. Things a step does not change never move.
```animation
family app "the app"
family data "data"
person u "reader"
group app "web app" layout=column is=app
box h "handler" in app is=app
box cache "cache" is=data
cylinder db "database" is=data
group tray "pages ready" layout=row
u -> app
app -> cache
app -> db
@step A reader asks the web app for a page.
send "GET /a" u -> app
@step The app looks in the cache; then the cache answers.
spotlight app cache
send "find /a" app -> cache
then
say cache below: not here
@step So the app reads the database. The pace is slow, so the wait shows.
pace slow
send "read /a" app -> db
@step The handler builds the page; then it moves over to the pages that are ready.
add box page "page /a" in app is=app
then
move page to tray path=arc
```

Animation by a new author: a queue with workers

Written from the spec alone by a helper that had not seen the engine; doccheck passed it on the first try.

Animation, 6 steps. Starts with: box api "API"; queue q "jobs": empty; group w1 "worker 1"; group w2 "worker 2". Connected: api -> q, q -> w1, q -> w2. 1. The API adds three jobs to the queue. 2. Worker 1 takes the oldest job from the front. 3. Worker 2 takes the next job. 4. Worker 1 finishes job 1, so the job is gone. 5. Worker 1 takes the next job in line. 6. The API keeps adding work while the workers run.

jobsjobsworker 1worker 1worker 2worker 2APIAPIjob 1job 1job 2job 2job 3job 3
1The API adds three jobs to the queue.
1 / 6
All steps (6)
Source: `fixtures/format/60-animation-by-a-new-author-a-queue-with-workers.dh.md`
text
---
title: "Animation by a new author: a queue with workers"
description: A fixture made from the Format page section of the same name.
---
## Animation by a new author: a queue with workers
Written from the spec alone by a helper that had not seen the engine; doccheck passed it on the first try.
```animation
box api "API"
queue q "jobs"
group w1 "worker 1" layout=row
group w2 "worker 2" layout=row
api -> q
q -> w1
q -> w2
@step The API adds three jobs to the queue.
push q "job 1" as j1
push q "job 2" as j2
push q "job 3" as j3
@step Worker 1 takes the oldest job from the front.
pop q to w1
@step Worker 2 takes the next job.
pop q to w2
@step Worker 1 finishes job 1, so the job is gone.
remove j1
say w1: done!
@step Worker 1 takes the next job in line.
pop q to w1
@step The API keeps adding work while the workers run.
push q "job 4" as j4
```

Animation by a new author: a CDN miss, then a hit

The second scene from the same first try.

Animation, 7 steps. Starts with: person u1 "user 1"; group edge "CDN edge"; cylinder origin "origin server". Connected: u1 <-> edge, edge <-> origin. 1. User 1 asks the CDN edge for logo.png. u1 -> edge: GET logo.png 2. The edge has no copy: a miss. 3. The edge fetches the file from the origin server. edge -> origin: GET logo.png 4. The origin answers, and the edge keeps a copy. origin -> edge: logo.png 5. The edge answers user 1. edge -> u1: logo.png 6. User 2 asks the edge for the same file. u2 -> edge: GET logo.png 7. The edge has a copy: a hit. It answers at once, with no trip to the origin. edge -> u2: logo.png

CDN edgeCDN edgeuser 1user 1origin server · holds the original fileorigin serverGET logo.png
1User 1 asks the CDN edge for logo.png.
1 / 7
All steps (7)
Source: `fixtures/format/61-animation-by-a-new-author-a-cdn-miss-then-a-hit.dh.md`
text
---
title: "Animation by a new author: a CDN miss, then a hit"
description: A fixture made from the Format page section of the same name.
---
## Animation by a new author: a CDN miss, then a hit
The second scene from the same first try.
```animation
person u1 "user 1"
group edge "CDN edge" layout=row
cylinder origin "origin server" note="holds the original file"
u1 <-> edge
edge <-> origin
@step User 1 asks the CDN edge for logo.png.
send "GET logo.png" u1 -> edge
@step The edge has no copy: a miss.
say edge: Miss!
highlight edge tone=warn
@step The edge fetches the file from the origin server.
send "GET logo.png" edge -> origin
camera edge origin
@step The origin answers, and the edge keeps a copy.
send "logo.png" origin -> edge
add box copy "logo.png" in edge
@step The edge answers user 1.
send "logo.png" edge -> u1
camera all
@step User 2 asks the edge for the same file.
add person u2 "user 2"
u2 <-> edge
send "GET logo.png" u2 -> edge
@step The edge has a copy: a hit. It answers at once, with no trip to the origin.
say edge: Hit!
highlight copy tone=good
send "logo.png" edge -> u2
camera edge u2
```

Animation: one thing splits, travels and merges

A token can be cut into pieces and put back together. split f into 3 "part" makes three tokens, f.1 to f.3 ("part 1" to "part 3"), where f was. move f.1 f.2 f.3 into b moves them together, as one hop. merge f puts the pieces back into f. A token can sit at a thing (token t "req" at api) or wait in a container (token f "photo.jpg" in a).

Animation, 4 steps. Starts with: group a "sender" [token f "photo.jpg"]; group b "receiver". Connected: a -> b. 1. The sender has a file that is too big for one packet. 2. It is split into three parts. f splits into: part 1, part 2, part 3 3. The parts travel together: one hop. a -> b: part 1, part 2, part 3 4. The receiver joins them back into the file. part 1, part 2, part 3 merge into f: photo.jpg

sendersenderreceiverreceiverphoto.jpgphoto.jpg
1The sender has a file that is too big for one packet.
1 / 4
All steps (4)
Source: `fixtures/format/62-animation-one-thing-splits-travels-and-merges.dh.md`
text
---
title: "Animation: one thing splits, travels and merges"
description: A fixture made from the Format page section of the same name.
---
## Animation: one thing splits, travels and merges
A token can be cut into pieces and put back together. `split f into 3 "part"` makes three tokens, `f.1` to `f.3` ("part 1" to "part 3"), where `f` was. `move f.1 f.2 f.3 into b` moves them together, as one hop. `merge f` puts the pieces back into `f`. A token can sit at a thing (`token t "req" at api`) or wait in a container (`token f "photo.jpg" in a`).
```animation
group a "sender" layout=column
group b "receiver" layout=column
a -> b
token f "photo.jpg" in a
@step The sender has a file that is too big for one packet.
highlight f
@step It is split into three parts.
split f into 3 "part"
@step The parts travel together: one hop.
move f.1 f.2 f.3 into b
@step The receiver joins them back into the file.
merge f
```

Animation: an array, a map and a tree in one scene

Data structures are things like any other, and live in one scene with a person, a service and a database. Each is closed=yes: small and faint until the story zooms into it. map cart "cart sizes" buckets=3: ana: 3, ... is a map of keys and values, drawn as a hash table: a key's bucket is the sum of its letters' codes, mod 3. get cart ana looks a key up (its entry lights up, and its bucket is framed), get ids 3 reads an array by index, and put cart dee: 4 adds an entry. dir=down on the fence runs the scene top to bottom. Without buckets=, a map is a table of keys and values.

Animation, 11 steps. Starts with: person ana "Ana"; group api "orders service" [array ids "sorted ids": 12, 19, 27, 34, map cart "cart sizes" closed, 3 buckets, a key's bucket is the sum of its letters' codes mod 3: ben: 7 (bucket 0), ana: 3 (bucket 1), cy: 9 (bucket 1), tree idx "price index" closed [pill p30 "30", pill p20 "20" under p30 left, pill p50 "50" under p30 right, pill p40 "40" under p50 left]]; cylinder db "orders database". Connected: ana -> api, api -> db. Families, one colour each: svc "the service" (api); data "its data" (ids, cart, idx). 1. Ana asks for her orders. The service keeps three structures in memory. 2. Zoom into the array: four ids, sorted. zoom into ids 3. Index 3 is read at once: 34. No search. get ids 3 -> 34 4. Now the map. A key's bucket: the sum of its letters' codes, mod 3. zoom out of ids zoom into cart 5. ana goes to bucket 1, which cy shares (a chain). Its value: 3 items. get cart ana -> 3 (bucket 1) 6. A new key, dee, goes to bucket 2. put cart dee: 4 7. Now the tree: smaller prices go left, bigger right. zoom out of cart zoom into idx 8. Find 40: at the root, 30, go right. 9. At 50, go left. 10. 40 is found. 11. Back out: the service answered from memory, not the database. zoom out of idx

  • the service
  • its data
orders serviceorders servicesorted ids · 4 itemssorted ids · 4 itemscart sizes · 3 keyscart sizes · 3 keysprice index · 4 nodesprice index · 4 nodes001122AnaAna12192734ben: 7ana: 3cy: 930205040orders databaseorders databasemy orders, please
1Ana asks for her orders. The service keeps three structures in memory.
1 / 11
All steps (11)
Source: `fixtures/format/63-animation-an-array-a-map-and-a-tree-in-one-scene.dh.md`
text
---
title: "Animation: an array, a map and a tree in one scene"
description: A fixture made from the Format page section of the same name.
---
## Animation: an array, a map and a tree in one scene
Data structures are things like any other, and live in one scene with a person, a service and a database. Each is `closed=yes`: small and faint until the story zooms into it. `map cart "cart sizes" buckets=3: ana: 3, ...` is a map of keys and values, drawn as a hash table: a key's bucket is the sum of its letters' codes, mod 3. `get cart ana` looks a key up (its entry lights up, and its bucket is framed), `get ids 3` reads an array by index, and `put cart dee: 4` adds an entry. `dir=down` on the fence runs the scene top to bottom. Without `buckets=`, a map is a table of keys and values.
```animation dir=down size=s
family svc "the service"
family data "its data"
person ana "Ana"
group api "orders service" layout=row is=svc
array ids "sorted ids" in api closed=yes is=data: 12, 19, 27, 34
map cart "cart sizes" in api buckets=3 closed=yes is=data: ana: 3, ben: 7, cy: 9
tree idx "price index" in api closed=yes is=data
pill p30 "30" in idx
pill p20 "20" in idx under p30 left
pill p50 "50" in idx under p30 right
pill p40 "40" in idx under p50 left
cylinder db "orders database"
ana -> api
api -> db
@step Ana asks for her orders. The service keeps three structures in memory.
say ana: my orders, please
@step Zoom into the array: four ids, sorted.
zoom into ids
@step Index 3 is read at once: 34. No search.
get ids 3
@step Now the map. A key's bucket: the sum of its letters' codes, mod 3.
zoom out
then
zoom into cart
@step ana goes to bucket 1, which cy shares (a chain). Its value: 3 items.
get cart ana
@step A new key, dee, goes to bucket 2.
put cart dee: 4
@step Now the tree: smaller prices go left, bigger right.
zoom out
then
zoom into idx
@step Find 40: at the root, 30, go right.
highlight p30
@step At 50, go left.
highlight p50
@step 40 is found.
highlight p40 tone=good
@step Back out: the service answered from memory, not the database.
zoom out
say ana: that was fast
```

3D: the stateless replay system in layers

Format version 5 adds layers. layer co "coordinator" declares one (the first is the top), and layer=co puts a thing on it; a thing without layer= sits on its container's layer. split layers pulls the layers apart, stack layers puts them back, and focus tc flies the camera to one layer while the others fade. A fence written ```animation 3d opens the scene in 3D; the 2D/3D button on every stage switches and keeps the step. In 3D: drag to turn; right-drag, Shift + drag or two fingers to move; the wheel, a pinch or + and − to zoom; once you click the stage, the arrow keys and W A S D move too. Click a thing for its note or a layer to zoom into it; the reset button puts the camera back. Here, one call goes down from the CLI to the template container and the answer comes back up.

Animation, 13 steps. Starts with: group cli "CLI" [text a0 "no answers yet"]; box coord "coordinator"; group box1 "template container" [text t0 "keeps nothing"]; cylinder img "template image". Connected: cli -> coord, coord -> box1, img --> coord. Layers, top to bottom: you "your machine" (cli); co "coordinator" (coord); tc "template container" (box1); reg "registry" (img). Families, one colour each: you "CLI" (cli); co "coordinator" (coord); tc "template container" (box1); reg "registry" (img). 1. Four layers: your CLI, the coordinator, the template container, and the registry. 2. First the coordinator pulls the template's image. img -> coord: image 3. It starts the template container from it. coord -> box1: start 4. Init call 1 goes down: the CLI calls the coordinator. It carries no answers. cli -> coord: init 1 · no answers 5. The coordinator forwards the call to the template container. coord -> box1: init 1 6. The script makes project id A and stops at its first unanswered question. 7. The question and the state go back up. The container keeps nothing. box1 -> coord: question: name · state: A 8. The coordinator hands them to the CLI. coord -> cli: question · state A 9. The container's layer alone: no answer, no session, no paused script. 10. You type hello-app. The CLI keeps it, and project id A. 11. Call 2 carries both down to the coordinator. cli -> coord: init 2 · name, A 12. It forwards call 2. The script runs again from line 1, past the name. coord -> box1: init 2 13. Every call goes down and back this way. Only the CLI holds the answers.

  • CLI
  • coordinator
  • template container
  • registry
your machineyour machinecoordinatorcoordinatortemplate containertemplate containerregistryregistryCLICLItemplate container · runs the script; keeps nothingtemplate containerno answers yetno answers yetcoordinator · starts templates in Docker and forwards each callcoordinatorkeeps nothingkeeps nothingtemplate imagetemplate image
1Four layers: your CLI, the coordinator, the template container, and the registry.
1 / 13
All steps (13)
Source: `fixtures/format/64-3d-the-stateless-replay-system-in-layers.dh.md`
text
---
title: "3D: the stateless replay system in layers"
description: A fixture made from the Format page section of the same name.
---
## 3D: the stateless replay system in layers
Format version 5 adds **layers**. `layer co "coordinator"` declares one (the first is the top), and `layer=co` puts a thing on it; a thing without `layer=` sits on its container's layer. `split layers` pulls the layers apart, `stack layers` puts them back, and `focus tc` flies the camera to one layer while the others fade. A fence written `` ```animation 3d `` opens the scene in 3D; the **2D/3D** button on every stage switches and keeps the step. In 3D: drag to turn; right-drag, Shift + drag or two fingers to move; the wheel, a pinch or + and − to zoom; once you click the stage, the arrow keys and W A S D move too. Click a thing for its note or a layer to zoom into it; the reset button puts the camera back. Here, one call goes down from the CLI to the template container and the answer comes back up.
```animation 3d
layer you "your machine"
layer co "coordinator"
layer tc "template container"
layer reg "registry"
family you "CLI"
family co "coordinator"
family tc "template container"
family reg "registry"
group cli "CLI" layer=you layout=column is=you
text a0 "no answers yet" in cli tone=muted
box coord "coordinator" layer=co is=co note="starts templates in Docker and forwards each call"
group box1 "template container" layer=tc layout=column is=tc note="runs the script; keeps nothing"
text t0 "keeps nothing" in box1 tone=muted
cylinder img "template image" layer=reg is=reg
cli -> coord -> box1
img --> coord
@step Four layers: your CLI, the coordinator, the template container, and the registry.
split layers
@step First the coordinator pulls the template's image.
send arrow "image" img -> coord
@step It starts the template container from it.
send arrow "start" coord -> box1
@step Init call 1 goes down: the CLI calls the coordinator. It carries no answers.
send arrow "init 1 · no answers" cli -> coord
@step The coordinator forwards the call to the template container.
send arrow "init 1" coord -> box1
@step The script makes project id A and stops at its first unanswered question.
add pill p1 "project-id A" in box1 tone=acc
say box1: no answer for name
@step The question and the state go back up. The container keeps nothing.
send arrow "question: name · state: A" box1 -> coord
remove p1
@step The coordinator hands them to the CLI.
send arrow "question · state A" coord -> cli
@step The container's layer alone: no answer, no session, no paused script.
focus tc
@step You type hello-app. The CLI keeps it, and project id A.
focus all
remove a0
add pill a1 "name = hello-app" in cli tone=good
add pill a2 "project-id A" in cli tone=acc
@step Call 2 carries both down to the coordinator.
send arrow "init 2 · name, A" cli -> coord
@step It forwards call 2. The script runs again from line 1, past the name.
send arrow "init 2" coord -> box1
@step Every call goes down and back this way. Only the CLI holds the answers.
stack layers
highlight cli
```

3D: Kubernetes, cluster to container

Boxes inside boxes: a cluster box holds node boxes, a node holds pod boxes, a pod holds its containers. This is a tree that only works in 3D, so the fence says 3d only and the stage has no 2D button. Every level starts closed=hidden: nothing inside it is drawn until zoom into opens it, so each step talks about one level and the smaller boxes stay out of the way. Zooms nest (zoom into n1, then zoom into p2), and each zoom pulls the box it opens up out of the one that holds it (lift n1, then lift p2: lifts nest too). lift k3 pulls redis up out of its pod to focus on it, put back sets it down again, and zoom out and zoom out all close the levels one at a time or all at once, putting each box back where it was. While a step plays, only the labels of what it touches show: here, redis alone as the camera flies to it.

Animation, 8 steps, 3D only. Starts with: group c "cluster" [group n1 "node 1" closed, inside hidden [group p1 "web-1" closed, inside hidden [box k1 "nginx", box k2 "log agent"], group p2 "cache-1" closed, inside hidden [box k3 "redis"]], group n2 "node 2" closed, inside hidden [group p3 "web-2" closed, inside hidden [box k4 "nginx", box k5 "log agent"]]]. 1. One cluster box holds two node boxes. What runs on the nodes is hidden: at this level we talk about machines. 2. Zoom into node 1: it rises out of the cluster, and its pod boxes appear, web-1 and cache-1. Node 2 fades. zoom into n1: its inside appears, the rest fades lift n1 out of c 3. Zoom into cache-1: it rises out of node 1, its box opens, and its one container shows, redis. zoom into p2: its inside appears, the rest fades lift p2 out of n1 4. Pull redis up out of its pod to focus on it. While the camera flies in, only its label shows. lift k3 out of p2 5. The redis container crashes. 6. The kubelet on node 1 starts it again, back in the same pod. The pod and the node stay as they were. put back k3 7. Zoom out to node 1: cache-1 settles back into the node and closes again; its container hides. zoom out of p2 p2 settle back into place 8. Zoom out all the way: node 1 settles back into the cluster. The smaller boxes hide, and we are back to talking about machines. zoom out all the way n1 settle back into place

This scene is drawn in 3D only. Without 3D (WebGL), here are its steps:

  1. One cluster box holds two node boxes. What runs on the nodes is hidden: at this level we talk about machines.
  2. Zoom into node 1: it rises out of the cluster, and its pod boxes appear, web-1 and cache-1. Node 2 fades.
  3. Zoom into cache-1: it rises out of node 1, its box opens, and its one container shows, redis.
  4. Pull redis up out of its pod to focus on it. While the camera flies in, only its label shows.
  5. The redis container crashes.
  6. The kubelet on node 1 starts it again, back in the same pod. The pod and the node stay as they were.
  7. Zoom out to node 1: cache-1 settles back into the node and closes again; its container hides.
  8. Zoom out all the way: node 1 settles back into the cluster. The smaller boxes hide, and we are back to talking about machines.
1One cluster box holds two node boxes. What runs on the nodes is hidden: at this level we talk about machines.
1 / 8
All steps (8)
Source: `fixtures/format/65-3d-kubernetes-cluster-to-container.dh.md`
text
---
title: "3D: Kubernetes, cluster to container"
description: A fixture made from the Format page section of the same name.
---
## 3D: Kubernetes, cluster to container
Boxes inside boxes: a cluster box holds node boxes, a node holds pod boxes, a pod holds its containers. This is a tree that only works in 3D, so the fence says `3d only` and the stage has no 2D button. Every level starts `closed=hidden`: nothing inside it is drawn until `zoom into` opens it, so each step talks about one level and the smaller boxes stay out of the way. Zooms nest (`zoom into n1`, then `zoom into p2`), and each zoom pulls the box it opens up out of the one that holds it (`lift n1`, then `lift p2`: lifts nest too). `lift k3` pulls redis up out of its pod to focus on it, `put back` sets it down again, and `zoom out` and `zoom out all` close the levels one at a time or all at once, putting each box back where it was. While a step plays, only the labels of what it touches show: here, redis alone as the camera flies to it.
```animation 3d only
group c "cluster"
group n1 "node 1" in c closed=hidden
group n2 "node 2" in c closed=hidden
group p1 "web-1" in n1 closed=hidden
group p2 "cache-1" in n1 closed=hidden
group p3 "web-2" in n2 closed=hidden
box k1 "nginx" in p1
box k2 "log agent" in p1
box k3 "redis" in p2
box k4 "nginx" in p3
box k5 "log agent" in p3
note n1: a machine; the kubelet on it runs the pods it is given
note p2: the unit the scheduler places; its containers share one network address
@step One cluster box holds two node boxes. What runs on the nodes is hidden: at this level we talk about machines.
camera all
@step Zoom into node 1: it rises out of the cluster, and its pod boxes appear, web-1 and cache-1. Node 2 fades.
zoom into n1
lift n1
camera n1
@step Zoom into cache-1: it rises out of node 1, its box opens, and its one container shows, redis.
zoom into p2
lift p2
camera p2
@step Pull redis up out of its pod to focus on it. While the camera flies in, only its label shows.
lift k3
camera k3
@step The redis container crashes.
set k3 down=yes
highlight k3 tone=hot
@step The kubelet on node 1 starts it again, back in the same pod. The pod and the node stay as they were.
put back k3
remove k3
add box k3b "redis" in p2 tone=good
camera p2
@step Zoom out to node 1: cache-1 settles back into the node and closes again; its container hides.
zoom out
@step Zoom out all the way: node 1 settles back into the cluster. The smaller boxes hide, and we are back to talking about machines.
zoom out all
```

Animation: a packet through kube-proxy

Two nodes and the VPC under them, drawn flat so every word reads: each node shows its pods, its kernel and its network card, and every step is drawn at one fixed place. layout=row puts the nodes side by side with the VPC between them; on a phone they stack, node 1 above the VPC above node 2. The call takes the real path: the frontend's veth, node 1's kernel, where a rule kube-proxy wrote rewrites the service's virtual IP to one pod's IP (kube-proxy itself never carries the packet), node 1's network card, the VPC, node 2's network card and kernel, web-2's veth. The reply comes back the same way, and node 1's conntrack undoes the rewrite.

Animation, 22 steps, flat. Node 1 (frontend pod 198.51.100.4, kube-proxy; kernel with the frontend's veth, the iptables rules, conntrack; network card), the VPC, node 2 (web-2 198.51.100.7, kube-proxy; kernel with web-2's veth and routes; network card). kube-proxy only writes the rules. 1. to 4. The nodes and the VPC; kube-proxy writes rules on every node; the frontend calls the service at 192.0.2.10, a virtual IP. 5. to 8. Veth, node 1's kernel: a rule rewrites the destination to 198.51.100.7, conntrack notes it, node 1 routes it out of its card. 9. to 13. The VPC (AWS VPC CNI: the IP belongs to node 2's card) delivers it; node 2's kernel routes it through the veth into web-2. No second rewrite. 14. to 22. The reply comes back the same hops; node 1's conntrack restores the source 192.0.2.10. A routed CNI or an overlay would do the middle hop instead.

  • pods
  • kube-proxy
  • node kernels
  • network cards and the VPC
node 1 · node IP 198.51.100.21node 1node 2 · node IP 198.51.100.22node 2n1pkernelkerneln2pkernelkernelfrontend · a pod; pod IP 198.51.100.4frontendkube-proxy · runs on every node; watches the API for services and their pods, and writes the rules. It never carries a packetkube-proxyveth · the frontend's veth: a cable with one end in the pod and one in the nodevethrules · the iptables rules kube-proxy wrote: every packet to 192.0.2.10 meets themrulesconntrack · remembers each rewrite, to undo it on the replyconntracknetwork card · eth0, node 1's network cardnetwork cardVPC · the network under the cluster. Its route table: 198.51.100.0/24 is local. With AWS's VPC CNI, web-2's IP 198.51.100.7 is a second address of node 2's network cardVPCweb-2 · a pod of the service web; pod IP 198.51.100.7web-2kube-proxy · the same on every nodekube-proxyveth · web-2's vethvethroutes · 198.51.100.7 is a pod on this node: through web-2's vethroutesnetwork card · eth0, node 2's network cardnetwork card
1Two nodes and the VPC, the network under them.
1 / 22
All steps (22)
Source: `fixtures/format/66-animation-a-packet-through-kube-proxy.dh.md`
text
---
title: "Animation: a packet through kube-proxy"
description: A fixture made from the Format page section of the same name.
---
## Animation: a packet through kube-proxy
Two nodes and the VPC under them, drawn flat so every word reads: each node shows its pods, its kernel and its network card, and every step is drawn at one fixed place. `layout=row` puts the nodes side by side with the VPC between them; on a phone they stack, node 1 above the VPC above node 2. The call takes the real path: the frontend's veth, node 1's kernel, where a rule kube-proxy wrote rewrites the service's virtual IP to one pod's IP (kube-proxy itself never carries the packet), node 1's network card, the VPC, node 2's network card and kernel, web-2's veth. The reply comes back the same way, and node 1's conntrack undoes the rewrite.
```animation layout=row
family pod "pods"
family kp "kube-proxy"
family kern "node kernels"
family net "network cards and the VPC"
group n1 "node 1" layout=column note="node IP 198.51.100.21"
group n1p in n1 layout=row
box fe "frontend" in n1p is=pod note="a pod; pod IP 198.51.100.4"
box kp1 "kube-proxy" in n1p is=kp note="runs on every node; watches the API for services and their pods, and writes the rules. It never carries a packet"
group n1k "kernel" in n1 layout=row is=kern
box v1 "veth" in n1k is=kern size=s note="the frontend's veth: a cable with one end in the pod and one in the node"
box r1 "rules" in n1k is=kern size=s note="the iptables rules kube-proxy wrote: every packet to 192.0.2.10 meets them"
box ct1 "conntrack" in n1k is=kern size=s note="remembers each rewrite, to undo it on the reply"
box e1 "network card" in n1 is=net note="eth0, node 1's network card"
box vr "VPC" is=net note="the network under the cluster. Its route table: 198.51.100.0/24 is local. With AWS's VPC CNI, web-2's IP 198.51.100.7 is a second address of node 2's network card"
group n2 "node 2" layout=column note="node IP 198.51.100.22"
group n2p in n2 layout=row
box w2 "web-2" in n2p is=pod note="a pod of the service web; pod IP 198.51.100.7"
box kp2 "kube-proxy" in n2p is=kp note="the same on every node"
group n2k "kernel" in n2 layout=row is=kern
box v2 "veth" in n2k is=kern size=s note="web-2's veth"
box rt2 "routes" in n2k is=kern size=s note="198.51.100.7 is a pod on this node: through web-2's veth"
box e2 "network card" in n2 is=net note="eth0, node 2's network card"
e1 -> vr
vr -> e2
@step Two nodes and the VPC, the network under them.
@step On each node: its pods at the top, its kernel, and its network card at the bottom, where packets leave and enter the node.
@step kube-proxy runs on every node. It watches the API for the service web and writes rules into the kernel's iptables. It never carries a packet.
highlight kp1
@step The frontend calls the service web at 192.0.2.10. No pod and no machine has that address: it lives only in rules.
highlight fe
@step The packet leaves the frontend through its veth, into node 1's kernel.
send fe -> v1
@step In node 1's kernel it meets the rules kube-proxy wrote. kube-proxy itself never touches the packet.
send "to 192.0.2.10" v1 -> r1
@step A rule picks one of the service's pods at random, web-2, and rewrites the destination to its IP. conntrack writes the rewrite down.
say r1 above: → 198.51.100.7
highlight r1
@step 198.51.100.7 is not on node 1, so node 1's kernel routes the packet out of its own network card.
send r1 -> e1
@step The packet enters the VPC. Its route table knows 198.51.100.7: on AWS's VPC CNI, it is an address of node 2's network card.
send "to 198.51.100.7" e1 -> vr
say vr above: 198.51.100.7 → node 2
@step The VPC delivers it to node 2's network card. No tunnel and no rewrite on the way.
send vr -> e2
@step Node 2's kernel looks up its routes: 198.51.100.7 is a pod on this node.
send e2 -> rt2
@step The route sends it into web-2's veth.
send rt2 -> v2
@step Through the veth into web-2. No second rewrite: the address is already a pod's.
send v2 -> w2
@step web-2 answers from 198.51.100.7, back into its veth.
send w2 -> v2
@step Into node 2's kernel, which routes the reply toward 198.51.100.4.
send "200 OK" v2 -> rt2
@step Out of node 2's network card.
send rt2 -> e2
@step Into the VPC: 198.51.100.4 is an address of node 1's network card.
send "200 OK" e2 -> vr
@step The VPC delivers it to node 1's network card.
send "200 OK" vr -> e1
@step Into node 1's kernel, where conntrack knows this reply: it belongs to the rewrite it wrote down.
send e1 -> ct1
@step conntrack undoes the rewrite: the source 198.51.100.7 becomes 192.0.2.10 again.
highlight ct1
@step Out of node 1's kernel into the frontend's veth.
send "from 192.0.2.10" ct1 -> v1
@step Into the frontend, which sees the service answer. Other networks under a cluster do the middle hop another way: a routed CNI has a route "node 2's pod range → node 2"; an overlay wraps the packet from node IP to node IP. The kube-proxy part stays the same.
send v1 -> fe
```
:::llm
Animation, 22 steps, flat. Node 1 (frontend pod 198.51.100.4, kube-proxy; kernel with the frontend's veth, the iptables rules, conntrack; network card), the VPC, node 2 (web-2 198.51.100.7, kube-proxy; kernel with web-2's veth and routes; network card). kube-proxy only writes the rules.
1. to 4. The nodes and the VPC; kube-proxy writes rules on every node; the frontend calls the service at 192.0.2.10, a virtual IP.
5. to 8. Veth, node 1's kernel: a rule rewrites the destination to 198.51.100.7, conntrack notes it, node 1 routes it out of its card.
9. to 13. The VPC (AWS VPC CNI: the IP belongs to node 2's card) delivers it; node 2's kernel routes it through the veth into web-2. No second rewrite.
14. to 22. The reply comes back the same hops; node 1's conntrack restores the source 192.0.2.10. A routed CNI or an overlay would do the middle hop instead.
:::

3D: a request through the network layers

Two machines with the same five layers. When top-level things sit on two or more layers, the 2D stage draws one band per layer and lines up each band's things in columns, so the two stacks stand side by side.

Animation, 12 steps. Starts with: box a1 "browser"; box b1 "web server"; box a2 "encrypt"; box b2 "decrypt"; box a3 "segments"; box b3 "segments"; box a4 "packets"; box b4 "packets"; box a5 "Wi-Fi"; box b5 "Ethernet". Connected: a1 -> a2, a2 -> a3, a3 -> a4, a4 -> a5, b5 -> b4, b4 -> b3, b3 -> b2, b2 -> b1, a5 -> b5 "the wire". Layers, top to bottom: app "application" (a1, b1); tls "TLS" (a2, b2); tcp "TCP" (a3, b3); ip "IP" (a4, b4); link (a5, b5). Families, one colour each: cl "the browser's machine" (a1, a2, a3, a4, a5); sv "the server's machine" (b1, b2, b3, b4, b5). 1. A browser on one machine asks a web server on another for a page. Each machine has the same five layers. 2. Going down: TLS encrypts the request. a1 -> a2: GET / 3. TCP cuts it into numbered segments. a2 -> a3: encrypted 4. IP addresses each one: packets. a3 -> a4: segments 5. The link layer makes them signals. a4 -> a5: packets 6. The signals cross the wire to the other machine. a5 -> b5: bits 7. Going up, each layer undoes its twin's work: to IP. b5 -> b4: bits 8. IP hands the segments to TCP. b4 -> b3: packets 9. TCP puts them in order, for TLS. b3 -> b2: segments 10. TLS decrypts the request, and the web server reads it. b2 -> b1: GET / 11. Look at one layer: TCP on both machines talks only to TCP. The layers above and below are its tools. 12. The web server's reply goes back to the browser the same way, one layer per hop.

  • the browser's machine
  • the server's machine
applicationapplicationTLSTLSTCPTCPIPIPlinklinkthe wirebrowserbrowserweb serverweb serverencryptencryptdecryptdecryptsegmentssegmentssegmentssegmentspacketspacketspacketspacketsWi-Fi · the laptop's network cardWi-FiEthernet · the server's network cardEthernet
1A browser on one machine asks a web server on another for a page. Each machine has the same five layers.
1 / 12
All steps (12)
Source: `fixtures/format/67-3d-a-request-through-the-network-layers.dh.md`
text
---
title: "3D: a request through the network layers"
description: A fixture made from the Format page section of the same name.
---
## 3D: a request through the network layers
Two machines with the same five layers. When top-level things sit on two or more layers, the 2D stage draws one band per layer and lines up each band's things in columns, so the two stacks stand side by side.
```animation 3d
layer app "application"
layer tls "TLS"
layer tcp "TCP"
layer ip "IP"
layer link "link"
family cl "the browser's machine"
family sv "the server's machine"
box a1 "browser" layer=app is=cl
box b1 "web server" layer=app is=sv
box a2 "encrypt" layer=tls is=cl
box b2 "decrypt" layer=tls is=sv
box a3 "segments" layer=tcp is=cl
box b3 "segments" layer=tcp is=sv
box a4 "packets" layer=ip is=cl
box b4 "packets" layer=ip is=sv
box a5 "Wi-Fi" layer=link is=cl note="the laptop's network card"
box b5 "Ethernet" layer=link is=sv note="the server's network card"
a1 -> a2 -> a3 -> a4 -> a5
b5 -> b4 -> b3 -> b2 -> b1
a5 -> b5 "the wire"
@step A browser on one machine asks a web server on another for a page. Each machine has the same five layers.
split layers
@step Going down: TLS encrypts the request.
send "GET /" a1 -> a2
@step TCP cuts it into numbered segments.
send "encrypted" a2 -> a3
camera a3 close turn=left
@step IP addresses each one: packets.
send "segments" a3 -> a4
camera a4 close turn=left
@step The link layer makes them signals.
send "packets" a4 -> a5
camera a5 close turn=left tilt=low
@step The signals cross the wire to the other machine.
send "bits" a5 -> b5
camera a5 b5 turn=front tilt=low
@step Going up, each layer undoes its twin's work: to IP.
send "bits" b5 -> b4
camera all
@step IP hands the segments to TCP.
send "packets" b4 -> b3
@step TCP puts them in order, for TLS.
send "segments" b3 -> b2
@step TLS decrypts the request, and the web server reads it.
send "GET /" b2 -> b1
@step Look at one layer: TCP on both machines talks only to TCP. The layers above and below are its tools.
focus tcp
highlight a3 b3
@step The web server's reply goes back to the browser the same way, one layer per hop.
focus all
stack layers
highlight b1 a1 tone=good
say b1: 200 OK
```

3D: a message through a router, in segments

A thing can have an inside. group r "router" closed=yes draws the router's inside faint and without words; zoom into r flies the camera in and opens it, and zoom out closes it again. Inside, a queue holds tokens: move ... into q puts them at its back, and pop q to p2 takes the front one out. drop msg.4 at q sends a token there and loses it, the way a full router drops a packet. Here, TCP cuts a message into segments, a router forwards them, one is lost and sent again, and host B puts the message back together.

Animation, 13 steps. Starts with: group ha "host A" [token msg "message"]; group r "router" closed [queue q "input queue": empty, table rt: to, port, group p2 "port 2"]; group hb "host B". Connected: ha -> q, p2 -> hb. Layers, top to bottom: net "one network" (ha, r, hb). Families, one colour each: a "host A" (ha, msg); b "host B" (hb); rr "router" (r, q, rt, p2). 1. Host A has one message for host B: too big for one packet. 2. TCP cuts it into four numbered segments. msg splits into: seg 1, seg 2, seg 3, seg 4 3. Zoom into the router: an input queue, a routing table, and port 2. zoom into r 4. The segments arrive. The queue holds three; segment 4 finds it full. ha -> q: seg 1, seg 2, seg 3 ha -> q: seg 4, dropped there (lost) 5. The routing table says host B is behind port 2. 6. The oldest segment leaves the queue for port 2. q -> p2: seg 1 7. The next one follows; segment 3 waits its turn. q -> p2: seg 2 8. Zoom out: segments 1 and 2 cross the wire to host B. zoom out of r p2 -> hb: seg 1, seg 2 9. Segment 3 follows them. q -> hb: seg 3 10. Host B has 1, 2 and 3, but not 4. Host A sends segment 4 again. 11. This time it gets through the router. ha -> r: seg 4 12. It reaches host B. r -> hb: seg 4 13. Host B puts the four segments back in order: the message. seg 1, seg 2, seg 3, seg 4 merge into msg: message

  • host A
  • host B
  • router
host Ahost Arouterrouterhost Bhost Binput queuerouting tableport 2host B · 2host C · 1messagemessage
1Host A has one message for host B: too big for one packet.
1 / 13
All steps (13)
Source: `fixtures/format/68-3d-a-message-through-a-router-in-segments.dh.md`
text
---
title: "3D: a message through a router, in segments"
description: A fixture made from the Format page section of the same name.
---
## 3D: a message through a router, in segments
A thing can have an inside. `group r "router" closed=yes` draws the router's inside faint and without words; `zoom into r` flies the camera in and opens it, and `zoom out` closes it again. Inside, a queue holds tokens: `move ... into q` puts them at its back, and `pop q to p2` takes the front one out. `drop msg.4 at q` sends a token there and loses it, the way a full router drops a packet. Here, TCP cuts a message into segments, a router forwards them, one is lost and sent again, and host B puts the message back together.
```animation 3d
layer net "one network"
family a "host A"
family b "host B"
family rr "router"
group ha "host A" layout=column is=a
group r "router" closed=yes layout=free is=rr
queue q "input queue" in r pos=0,0 is=rr
table rt "routing table" in r pos=0,2.2 is=rr: to, port
row r1 in rt: host B, 2
row r2 in rt: host C, 1
group p2 "port 2" in r layout=column pos=4.4,2.2 is=rr
group hb "host B" layout=column is=b
ha -> q
p2 -> hb
token msg "message" in ha is=a
@step Host A has one message for host B: too big for one packet.
highlight msg
@step TCP cuts it into four numbered segments.
split msg into 4 "seg"
@step Zoom into the router: an input queue, a routing table, and port 2.
zoom into r
@step The segments arrive. The queue holds three; segment 4 finds it full.
move msg.1 msg.2 msg.3 into q
drop msg.4 at q
@step The routing table says host B is behind port 2.
highlight r1
@step The oldest segment leaves the queue for port 2.
pop q to p2
@step The next one follows; segment 3 waits its turn.
pop q to p2
@step Zoom out: segments 1 and 2 cross the wire to host B.
zoom out
move msg.1 msg.2 into hb
@step Segment 3 follows them.
pop q to hb
@step Host B has 1, 2 and 3, but not 4. Host A sends segment 4 again.
add token msg.4 "seg 4" in ha
@step This time it gets through the router.
move msg.4 to r
@step It reaches host B.
move msg.4 into hb
@step Host B puts the four segments back in order: the message.
merge msg
```

3D: the seven network layers, and a scene inside the scene

A scene can hold a scene of its own. scene tcp "Transport, up close" in the setup, its own lines, then end, declares it, with its own things and layout. enter tcp from a4 flies the camera into a4 and shows that scene instead of the overview; the steps after it change that scene; leave flies back out to the overview, just as it was left. The caption says which scene you are in, the slider marks its steps, and "All steps" lists them inside the step that enters. Here, a request goes down the seven layers of the OSI model on one machine and up them on the other; at layer 4 the story zooms into how TCP labels, cuts and rebuilds the message. It reads the same in 2D: press 2D.

Animation, 18 steps, with 1 scene inside it (tcp "Transport, up close"). Two machines, each with the seven OSI layers; a request ("GET /") starts in the browser at layer 7. 1. to 4. Down layers 7, 6 (formatted, encrypted) and 5 (session) to layer 4, where TCP splits it into seg 1 to 3. 5. Enters scene tcp from a4: the sender's TCP (the 3,000 bytes, a header with ports and a sequence number), a network, the receiver's TCP. 6. to 11. Cut into seq 1, seq 1001, seq 2001; all cross the network; 1 and 3 arrive first; 2 arrives late and goes between them; joined again; the receiver answers ACK 3001. 12. Leaves scene tcp: back to the overview, as it was, at a4. 13. to 18. Down layers 3, 2 and 1, across the wire, up to layer 4 where TCP joins the segments, and up to the web server, which reads GET /.

  • the browser's machine
  • the server's machine
7 application7 application6 presentation6 presentation5 session5 session4 transport4 transport3 network3 network2 data link2 data link1 physical1 physicalthe wirebrowserbrowserweb serverweb serverformat, encryptformat, encryptdecryptdecryptsessionsessionsessionsessionTCPTCPTCPTCPIPIPIPIPEthernetEthernetEthernetEthernetsignalssignalssignalssignalsGET /GET /
1A browser asks a web server for a page. The request starts at layer 7, application: HTTP.
1 / 18
All steps (18)
Source: `fixtures/format/69-3d-the-seven-network-layers-and-a-scene-inside-the-scene.dh.md`
text
---
title: "3D: the seven network layers, and a scene inside the scene"
description: A fixture made from the Format page section of the same name.
---
## 3D: the seven network layers, and a scene inside the scene
A scene can hold a scene of its own. `scene tcp "Transport, up close"` in the setup, its own lines, then `end`, declares it, with its own things and layout. `enter tcp from a4` flies the camera into `a4` and shows that scene instead of the overview; the steps after it change that scene; `leave` flies back out to the overview, just as it was left. The caption says which scene you are in, the slider marks its steps, and "All steps" lists them inside the step that enters. Here, a request goes down the seven layers of the OSI model on one machine and up them on the other; at layer 4 the story zooms into how TCP labels, cuts and rebuilds the message. It reads the same in 2D: press **2D**.
```animation 3d size=s
layer l7 "7 application"
layer l6 "6 presentation"
layer l5 "5 session"
layer l4 "4 transport"
layer l3 "3 network"
layer l2 "2 data link"
layer l1 "1 physical"
family cl "the browser's machine"
family sv "the server's machine"
box a7 "browser" layer=l7 is=cl
box b7 "web server" layer=l7 is=sv
box a6 "format, encrypt" layer=l6 is=cl
box b6 "decrypt" layer=l6 is=sv
box a5 "session" layer=l5 is=cl
box b5 "session" layer=l5 is=sv
box a4 "TCP" layer=l4 is=cl
box b4 "TCP" layer=l4 is=sv
box a3 "IP" layer=l3 is=cl
box b3 "IP" layer=l3 is=sv
box a2 "Ethernet" layer=l2 is=cl
box b2 "Ethernet" layer=l2 is=sv
box a1 "signals" layer=l1 is=cl
box b1 "signals" layer=l1 is=sv
a7 -> a6 -> a5 -> a4 -> a3 -> a2 -> a1
b1 -> b2 -> b3 -> b4 -> b5 -> b6 -> b7
a1 -> b1 "the wire"
token msg "GET /" at a7 is=cl
scene tcp "Transport, up close" layout=column
group snd "sender's TCP" layout=column is=cl
group out "to send" in snd layout=row
token m "3,000 bytes" in out is=cl
table hdr "TCP header" in snd: field, value
row h1 in hdr: from port, 51514
row h2 in hdr: to port, 443
row h3 in hdr: sequence, its first byte
cloud net "the network"
group rcv "receiver's TCP" layout=column is=sv
group buf "receive buffer" in rcv layout=row
snd -> net -> rcv
end
@step A browser asks a web server for a page. The request starts at layer 7, application: HTTP.
split layers
highlight a7
@step Layer 6, presentation: the request is put in an agreed format and encrypted.
move msg to a6
set msg label=encrypted
@step Layer 5, session: the conversation between the two programs stays open for the reply.
move msg to a5
@step Layer 4, transport: TCP cuts the message into three numbered segments.
move msg to a4
then
split msg into 3 "seg"
@step Up close: how TCP labels the segments, sends them, and puts them back together.
enter tcp from a4
@step Each segment gets a TCP header: the ports say which program it is from and for; the sequence number says where its bytes go.
highlight hdr
@step TCP cuts the 3,000 bytes into three segments of 1,000. Each is numbered by its first byte: 1, 1001, 2001.
split m into s1 "seq 1" s2 "seq 1001" s3 "seq 2001"
@step All three go out on the network. Each may take its own path.
move s1 s2 s3 to net
@step Segments 1 and 3 arrive first. TCP keeps 3 aside: bytes from 1001 are missing.
move s1 s3 into buf
@step Segment 2 arrives late. Its sequence number says where it goes: between 1 and 3.
move s2 into buf after s1
@step In order again, the segments are joined back into the 3,000 bytes. TCP sends back ACK 3001: "next, I expect byte 3001".
merge s1 s2 s3 into m2 "3,000 bytes"
send arrow "ACK 3001" rcv -> net
@step Back at the overview, where we left it. Now follow the segments down, across and up.
leave
@step Layer 3, network: each segment gets an IP header with both machines' addresses. It is now a packet.
move msg.1 msg.2 msg.3 to a3
@step Layer 2, data link: each packet goes in a frame for the next hop on the local network.
move msg.1 msg.2 msg.3 to a2
@step Layer 1, physical: the frames become signals.
move msg.1 msg.2 msg.3 to a1
@step The signals cross the wire to the server's machine.
move msg.1 msg.2 msg.3 to b1
@step Going up, layers 1 to 3 each read and remove their twin's header. TCP joins the segments, as we saw up close.
move msg.1 msg.2 msg.3 to b4
then
merge msg
@step Up through session and presentation, where it is decrypted, the web server reads the request.
move msg to b7
set msg label="GET /"
highlight b7 tone=good
```
:::llm
Animation, 18 steps, with 1 scene inside it (tcp "Transport, up close"). Two machines, each with the seven OSI layers; a request ("GET /") starts in the browser at layer 7.
1. to 4. Down layers 7, 6 (formatted, encrypted) and 5 (session) to layer 4, where TCP splits it into seg 1 to 3.
5. Enters scene tcp from a4: the sender's TCP (the 3,000 bytes, a header with ports and a sequence number), a network, the receiver's TCP.
6. to 11. Cut into seq 1, seq 1001, seq 2001; all cross the network; 1 and 3 arrive first; 2 arrives late and goes between them; joined again; the receiver answers ACK 3001.
12. Leaves scene tcp: back to the overview, as it was, at a4.
13. to 18. Down layers 3, 2 and 1, across the wire, up to layer 4 where TCP joins the segments, and up to the web server, which reads GET /.
:::

3D: a database in three regions

Regions as layers: a write lands in one region, and its copies arrive in the others at different times.

Animation, 7 steps. Starts with: person u1 "user in Virginia"; cylinder db1 "primary"; person u2 "user in Paris"; cylinder db2 "replica"; person u3 "user in Mumbai"; cylinder db3 "replica". Connected: db1 --> db2 "copies", db1 --> db3 "copies". Layers, top to bottom: us "us-east" (u1, db1); eu "eu-west" (u2, db2); ap "ap-south" (u3, db3). Families, one colour each: user "users" (u1, u2, u3); db "database" (db1, db2, db3); copy "copying" (db1 -> db2, db1 -> db3). 1. Three regions, each with a copy of the database. Only the primary, in us-east, takes writes. 2. A user in Virginia adds an item to their cart. The primary writes it as change 41. u1 -> db1: write: cart +1 3. The primary sends change 41 down to the other regions. db1 -> db2: change 41 db1 -> db3: change 41 4. Paris gets it first. 5. Mumbai is further away and still has change 40. 6. Look at ap-south alone: a read here now gets the cart without the new item. That gap is replication lag. u3 -> db3: read cart 7. A moment later change 41 arrives, and every region reads the same cart. u3 -> db3: read cart

  • users
  • database
  • copying
us-eastus-easteu-westeu-westap-southap-southcopiescopiesuser in Virginiauser in Virginiaprimary · takes every writeprimaryuser in Parisuser in Parisreplica · a read-only copyreplicauser in Mumbaiuser in Mumbaireplica · a read-only copyreplica
1Three regions, each with a copy of the database. Only the primary, in us-east, takes writes.
1 / 7
All steps (7)
Source: `fixtures/format/70-3d-a-database-in-three-regions.dh.md`
text
---
title: "3D: a database in three regions"
description: A fixture made from the Format page section of the same name.
---
## 3D: a database in three regions
Regions as layers: a write lands in one region, and its copies arrive in the others at different times.
```animation 3d
layer us "us-east"
layer eu "eu-west"
layer ap "ap-south"
family user "users"
family db "database"
family copy "copying"
person u1 "user in Virginia" layer=us is=user
cylinder db1 "primary" layer=us is=db note="takes every write"
person u2 "user in Paris" layer=eu is=user
cylinder db2 "replica" layer=eu is=db note="a read-only copy"
person u3 "user in Mumbai" layer=ap is=user
cylinder db3 "replica" layer=ap is=db note="a read-only copy"
db1 --> db2 "copies" is=copy
db1 --> db3 "copies" is=copy
@step Three regions, each with a copy of the database. Only the primary, in us-east, takes writes.
split layers
@step A user in Virginia adds an item to their cart. The primary writes it as change 41.
send "write: cart +1" u1 -> db1
say db1: change 41
@step The primary sends change 41 down to the other regions.
send arrow "change 41" db1 -> db2 is=copy
send arrow "change 41" db1 -> db3 is=copy
@step Paris gets it first.
highlight db2 tone=good
camera db2 db3 turn=right tilt=low
@step Mumbai is further away and still has change 40.
highlight db3 tone=warn
say db3: still at 40
@step Look at ap-south alone: a read here now gets the cart without the new item. That gap is replication lag.
focus ap
send "read cart" u3 -> db3
@step A moment later change 41 arrives, and every region reads the same cart.
focus all
camera all
highlight db3 tone=good
send "read cart" u3 -> db3
```

3D: not only code, a building's floors

Floors as layers, and people moving between them: move into a container on another layer carries a thing (and what it holds) up or down.

Animation, 5 steps. Starts with: group fl3 [group lift, box desk "Ana's desk"]; group fl2 [box cafe]; group fl1 [box gym]; group lobby [person ana "Ana", person ben "Ben"]. Layers, top to bottom: f3 "3rd floor: offices" (fl3); f2 "2nd floor: cafe" (fl2); f1 "1st floor: gym" (fl1); gr "lobby" (lobby). 1. A building with four floors. Ana and Ben wait in the lobby; the lift is up on the 3rd floor. 2. The lift comes down to the lobby. 3. Ana and Ben step in. 4. The lift goes up to the 2nd floor, and Ben gets out for coffee. 5. The lift goes on to the 3rd floor, and Ana walks to her desk.

3rd floor: offices3rd floor: offices2nd floor: cafe2nd floor: cafe1st floor: gym1st floor: gymlobbylobbyfl3fl2fl1lobbyliftliftAna's deskAna's deskcafecafegymgymAnaAnaBenBen
1A building with four floors. Ana and Ben wait in the lobby; the lift is up on the 3rd floor.
1 / 5
All steps (5)
Source: `fixtures/format/71-3d-not-only-code-a-building-s-floors.dh.md`
text
---
title: "3D: not only code, a building's floors"
description: A fixture made from the Format page section of the same name.
---
## 3D: not only code, a building's floors
Floors as layers, and people moving between them: `move` into a container on another layer carries a thing (and what it holds) up or down.
```animation 3d
layer f3 "3rd floor: offices"
layer f2 "2nd floor: cafe"
layer f1 "1st floor: gym"
layer gr "lobby"
group fl3 layer=f3
group fl2 layer=f2
group fl1 layer=f1
group lobby layer=gr
group lift "lift" in fl3 tone=acc
box desk "Ana's desk" in fl3
box cafe "cafe" in fl2
box gym "gym" in fl1
person ana "Ana" in lobby
person ben "Ben" in lobby
@step A building with four floors. Ana and Ben wait in the lobby; the lift is up on the 3rd floor.
split layers
@step The lift comes down to the lobby.
move lift to lobby
@step Ana and Ben step in.
move ana to lift
move ben to lift
@step The lift goes up to the 2nd floor, and Ben gets out for coffee.
move lift to fl2
then
move ben to fl2
@step The lift goes on to the 3rd floor, and Ana walks to her desk.
move lift to fl3
then
move ana to fl3 after desk
focus f3
```

3D: a 2D scene, unchanged

The pass-4 scene of pods, nodes and a service, with the same source. Press 3D on its stage: with no layers declared, each nesting level is a layer, so the cluster, the nodes and the pods stand at three heights.

Animation, 5 steps. Starts with: group cluster [group n1 "node 1" [pill w1 "web-1", pill c1 "cache-1"], group n2 "node 2" [pill w2 "web-2"], group n3 "node 3" [pill w3 "web-3"]]; pill svc "service: web". Connected: svc -> w1, svc -> w2, svc -> w3. 1. Pods run on nodes; nodes make up the cluster. The service is one name in front of the three web pods. 2. Calls to the service are spread over its pods: rules on every node pick one. svc -> w1: GET / svc -> w2: GET /cart 3. Node 2 dies, and web-2 with it. 4. The scheduler starts a new web-2 on node 3, which has room. 5. The rules now pick among the running pods only; nobody sees a gap. svc -> w2b: GET /cart

clusterclusternode 1node 1node 2node 2node 3node 3web-1web-1cache-1cache-1web-2web-2web-3web-3service: web · one stable name and address in front of the web podsservice: web
1Pods run on nodes; nodes make up the cluster. The service is one name in front of the three web pods.
1 / 5
All steps (5)
Source: `fixtures/format/72-3d-a-2d-scene-unchanged.dh.md`
text
---
title: "3D: a 2D scene, unchanged"
description: A fixture made from the Format page section of the same name.
---
## 3D: a 2D scene, unchanged
The pass-4 scene of pods, nodes and a service, with the same source. Press **3D** on its stage: with no layers declared, each nesting level is a layer, so the cluster, the nodes and the pods stand at three heights.
```animation dir=down
group cluster "cluster" layout=row
group n1 "node 1" in cluster
group n2 "node 2" in cluster
group n3 "node 3" in cluster
pill w1 "web-1" in n1
pill c1 "cache-1" in n1
pill w2 "web-2" in n2
pill w3 "web-3" in n3
pill svc "service: web"
svc -> w1
svc -> w2
svc -> w3
note svc: one stable name and address in front of the web pods
@step Pods run on nodes; nodes make up the cluster. The service is one name in front of the three web pods.
camera all
@step Calls to the service are spread over its pods: rules on every node pick one.
send "GET /" svc -> w1
send "GET /cart" svc -> w2
@step Node 2 dies, and web-2 with it.
set n2 down=yes
set w2 down=yes
camera cluster
@step The scheduler starts a new web-2 on node 3, which has room.
remove w2
add pill w2b "web-2" in n3 tone=good
svc -> w2b
@step The rules now pick among the running pods only; nobody sees a gap.
send "GET /cart" svc -> w2b
camera all
```

3D by a new author: a memory read

Written from the spec alone by a helper that had not seen the engine; doccheck passed it on the first try.

Animation, 8 steps. Starts with: box cpu "program"; box c1 "L1 cache"; box c2 "L2 cache"; box mem "RAM"; cylinder dsk "disk"; pill vx "x = 42". Connected: cpu -> c1, c1 -> c2, c2 -> mem, mem -> dsk. Layers, top to bottom: reg "registers" (cpu); l1 "L1 cache" (c1); l2 "L2 cache" (c2); ram "RAM" (mem, vx); disk (dsk). 1. The program wants the value x. It asks the fastest place first, the L1 cache, and x is not there (a miss). cpu -> c1: read x 2. The L1 cache passes the question down to the L2 cache. Another miss. c1 -> c2: read x 3. The L2 cache asks RAM, and RAM has x (a hit). The disk is not needed. c2 -> mem: read x 4. Zoom in on RAM. This is the slow part of the trip, which is why caches exist. 5. The camera pulls back. The value starts its way up, and the L2 cache keeps a copy. mem -> c2: x = 42 6. The L1 cache keeps a copy too. c2 -> c1: x = 42 7. The value reaches the program and is held in a register. c1 -> cpu: x = 42 8. Layers back together. The next read of x is answered at once, with no trip down.

registers · Inside the CPU. Tiny and the fastest place there is.registersL1 cache · Small and very fast. Each core has its own.L1 cacheL2 cache · Bigger than L1 and a bit slower.L2 cacheRAM · Main memory. Large, but far slower than the caches.RAMdisk · Storage. Huge, and by far the slowest.diskprogramprogramL1 cacheL1 cacheL2 cacheL2 cacheRAM · Holds the data the program is using right now.RAMdiskdiskx = 42x = 42read xmiss, no x here
1The program wants the value x. It asks the fastest place first, the L1 cache, and x is not there (a miss).
1 / 8
All steps (8)
Source: `fixtures/format/73-3d-by-a-new-author-a-memory-read.dh.md`
text
---
title: "3D by a new author: a memory read"
description: A fixture made from the Format page section of the same name.
---
## 3D by a new author: a memory read
Written from the spec alone by a helper that had not seen the engine; doccheck passed it on the first try.
```animation 3d dir=down
layer reg "registers" note="Inside the CPU. Tiny and the fastest place there is."
layer l1 "L1 cache" note="Small and very fast. Each core has its own."
layer l2 "L2 cache" note="Bigger than L1 and a bit slower."
layer ram "RAM" note="Main memory. Large, but far slower than the caches."
layer disk "disk" note="Storage. Huge, and by far the slowest."
box cpu "program" layer=reg
box c1 "L1 cache" layer=l1
box c2 "L2 cache" layer=l2
box mem "RAM" layer=ram note="Holds the data the program is using right now."
cylinder dsk "disk" layer=disk
pill vx "x = 42" layer=ram
cpu -> c1 -> c2 -> mem -> dsk
@step The program wants the value x. It asks the fastest place first, the L1 cache, and x is not there (a miss).
split layers
send "read x" cpu -> c1
say c1: miss, no x here
@step The L1 cache passes the question down to the L2 cache. Another miss.
send "read x" c1 -> c2
say c2: miss, no x here
highlight c2 tone=warn
@step The L2 cache asks RAM, and RAM has x (a hit). The disk is not needed.
send "read x" c2 -> mem
say mem: found x
highlight mem vx tone=good
set dsk dim=yes
@step Zoom in on RAM. This is the slow part of the trip, which is why caches exist.
focus ram
note vx: the value the program asked for
@step The camera pulls back. The value starts its way up, and the L2 cache keeps a copy.
focus all
send "x = 42" mem -> c2
add pill x2 "x = 42" layer=l2
@step The L1 cache keeps a copy too.
send "x = 42" c2 -> c1
add pill x1 "x = 42" layer=l1
@step The value reaches the program and is held in a register.
send "x = 42" c1 -> cpu
add pill xr "x = 42" layer=reg
@step Layers back together. The next read of x is answered at once, with no trip down.
stack layers
highlight xr tone=good
```

Animation: code, bold and italic in captions

Captions, say and note= take three marks: code, bold and italic. Words on the stage stay plain.

Animation, 3 steps. Starts with: person dev "you"; box repo; box ci "CI". 1. You run `task gen`; it is **never** done by *hand*. 2. CI checks that the **generated** files match. 3. Click the repo to read its note: it uses `code` and **bold** too.

task genyouyourepo · Holds the contract.yaml and the generated files.repoCICII rantask genfirst
1You run task gen; it is never done by hand.
1 / 3
All steps (3)
Source: `fixtures/format/93-animation-inline-marks.dh.md`
text
---
title: "Animation: code, bold and italic in captions"
description: Captions, speech and notes take three marks (SPEC 6.15); words on the stage stay plain.
---
## Animation: code, bold and italic in captions
Captions, `say` and `note=` take three marks: `code`, **bold** and *italic*. Words on the stage stay plain.
```animation layout=graph
person dev "you"
box repo "repo" note="Holds the `contract.yaml` and the **generated** files."
box ci "CI"
@step You run `task gen`; it is **never** done by *hand*.
dev -> repo "task gen"
say dev: I ran `task gen` first
@step CI checks that the **generated** files match.
repo -> ci "push"
@step Click the repo to read its note: it uses `code` and **bold** too.
highlight repo
```

Animation: long paths in labels

A path breaks only after a /, on a laptop and on a phone, and always keeps the name of its file.

Animation, 2 steps. Starts with: box src "features/checkout/observability/contract.yaml"; box out "internal/wiring/registry/providers.go"; box dash "observability/dashboards/checkout-overview.json". Connected: src -> out "task gen", src -> dash. 1. The contract is the one source. 2. One run generates both files from it.

task genfeatures/checkout/observability/contract.yamlfeatures/checkout/observability/contract.yamlinternal/wiring/registry/providers.gointernal/wiring/registry/providers.goobservability/dashboards/checkout-overview.jsonobservability/dashboards/checkout-overview.json
1The contract is the one source.
1 / 2
All steps (2)
Source: `fixtures/format/94-animation-long-paths-in-labels.dh.md`
text
---
title: "Animation: long paths in labels"
description: A path breaks only after a slash, on a laptop and on a phone, and always keeps the name of its file (SPEC 6.15).
---
## Animation: long paths in labels
A path breaks only after a `/`, on a laptop and on a phone, and always keeps the name of its file.
```animation layout=graph dir=down
box src "features/checkout/observability/contract.yaml"
box out "internal/wiring/registry/providers.go"
box dash "observability/dashboards/checkout-overview.json"
src -> out "task gen"
src -> dash
@step The contract is the one source.
highlight src
@step One run generates both files from it.
highlight out dash
```

Animation: a sent token becomes an item

send ... as <id> into a queue, a stack or a list leaves the token there as an item, so a later line can take it out.

Animation, 2 steps. Starts with: box app; queue buf "send buffer": empty; box net "network". Connected: app -> buf, buf -> net. 1. The app sends a segment into the buffer. app -> buf: seg 1 2. The network reads the oldest segment. buf -> net: seg 1

send buffersend bufferappappseg 1seg 1networknetwork
1The app sends a segment into the buffer.
1 / 2
All steps (2)
Source: `fixtures/format/95-animation-sent-items.dh.md`
text
---
title: "Animation: a sent token becomes an item"
description: A token sent into a queue joins it as an item that pop and move work on (SPEC 6.15).
---
## Animation: a sent token becomes an item
`send ... as <id>` into a queue, a stack or a list leaves the token there as an item, so a later line can take it out.
```animation layout=graph
box app "app"
queue buf "send buffer"
box net "network"
app -> buf
buf -> net
@step The app sends a segment into the buffer.
send "seg 1" app -> buf as s1
@step The network reads the oldest segment.
pop buf to net
```

The composed stage

Animation: a composed stage

An animation is composed by default: lanes left to right, cards with lines and badges, bands under lanes, then steps that show, light, tag and connect. The stage is laid out once for every step, so nothing moves; connectors are drawn after layout, from fanned ports, with their labels in the gap between lanes. Colours come from the page's roles: in the front matter, one per role on the whole page. A phone stacks the lanes. layout=graph on the fence sends a scene to the graph engine below instead.

Ordersone request, end to end1 / 4

Orders (one request, end to end) Browsers: laptop (sends GET /orders); phone (sends GET /orders); tablet (sends GET /orders); kiosk (sends GET /orders); about 2,000 sessions. Servers: api 0 (answers in JSON) [a: worker a; b: worker b]; api 1 (answers in JSON) [a: worker a; b: worker b]. Storage: orders database (primary; region east). Also (under Servers to Storage): config service (pushes routes and limits). 1. Ask: Each browser asks one server. GET: laptop to api 0, tablet to api 0, phone to api 1, kiosk to api 1 (dashed). laptop, tablet: to api 0. phone, kiosk: to api 1. 2. Read: The servers read from the database. SELECT: api 0 to orders database, api 1 to orders database (dashed). orders database says: one primary. 3. Config: The config service is off the data path. polled: config service to api 1, config service to orders database. 4. In short: Browsers pull from servers; servers read one database. Key (client): GET browser to server. Key (store): SELECT server to database.

Each browser asks one server.

Source: `fixtures/stage/01-animation-a-composed-stage.dh.md`
text
---
title: "Animation: a composed stage"
description: A fixture made from the Format page section of the same name (a composed stage).
roles:
client: c1
server: c2
store: c3
job: c4
cache: c5
ops: c6
plain: c0
---
## Animation: a composed stage
An animation is **composed** by default: lanes left to right, cards with lines and badges, bands under lanes, then steps that show, light, tag and connect. The stage is laid out once for every step, so nothing moves; connectors are drawn after layout, from fanned ports, with their labels in the gap between lanes. Colours come from the page's `roles:` in the front matter, one per role on the whole page. A phone stacks the lanes. `layout=graph` on the fence sends a scene to the graph engine below instead.
```animation
title: Orders | one request, end to end
## Browsers
client b1..b4: laptop; phone; tablet; kiosk | sends GET /orders
... about 2,000 sessions
## Servers
server s0,s1: api 0; api 1 | answers in JSON
+ (a) worker a; (b) worker b
## Storage
store db: orders database | primary | region east
## _ under Servers..Storage
ops cfg: config service | pushes routes and limits
@step Ask: Each browser asks one server.
b1,b3 --> s0: GET
b2,b4 --> s1: GET
tag b1,b3: to api 0
tag b2,b4: to api 1
light s0,s1
@step Read: The servers read from the database.
s0,s1 --> db (store): SELECT
say db: one primary
light db
@step Config: The config service is off the data path.
cfg -> s1, db: polled
light cfg
@step In short: Browsers pull from servers; servers read one database.
key client: GET browser to server
key store: SELECT server to database
```

Animation: a phase strip and swapped panels

A track: is a strip of phases, coloured by role; at puts each step on it, and carry: follows the step. A panel (grid, rows, map, list) shows only in its step, in one region as tall as the tallest, so the page does not jump. A grid item ends with a verdict, [+ kept] or [- why].

1 / 3

Phases: fetch, resolve, lookup, build, test, publish. Where: a monorepo of 40 packages · the main branch. 1. Resolve: Every package is listed; drafts and private ones are dropped. At: resolve (carrying one package). ui-kit (3.2.0 · ready): kept. router (1.9.4 · ready): kept. icons (0.8.0 · draft): dropped, draft: skip. internal-tools (0.1.0 · private): dropped, private: skip. only ready, public packages go on 2. Cache: Each package's hash picks its cache shard. At: lookup (carrying one package). ui-kit, 3.2.0 | hash = 0x51a2, shard 2 of 8 | cache shard 2 | a hit, built before router, 1.9.4 | hash = 0x9f07, shard 7 of 8 | cache shard 7 | a miss, build it a miss sends the package on to build 3. Publish: The built package is renamed for the registry. At: publish (carrying one package). router 1.9.4 (built from the main branch), rename: kept name, version, licence; dropped source maps, test files.

Every package is listed; drafts and private ones are dropped.

Source: `fixtures/stage/02-animation-a-phase-strip-and-swapped-panels.dh.md`
text
---
title: "Animation: a phase strip and swapped panels"
description: A fixture made from the Format page section of the same name (a composed stage).
roles:
client: c1
server: c2
store: c3
job: c4
cache: c5
ops: c6
plain: c0
---
## Animation: a phase strip and swapped panels
A `track:` is a strip of phases, coloured by role; `at` puts each step on it, and `carry:` follows the step. A panel (`grid`, `rows`, `map`, `list`) shows only in its step, in one region as tall as the tallest, so the page does not jump. A grid item ends with a verdict, `[+ kept]` or `[- why]`.
```animation
track: job fetch, resolve | cache lookup | job build, test | store publish
carry: one package
where: a monorepo of 40 packages · the main branch
@step Resolve: Every package is listed; drafts and private ones are dropped.
at resolve
grid 2
job: ui-kit | 3.2.0 · ready [+ kept]
job: router | 1.9.4 · ready [+ kept]
job: icons | 0.8.0 · draft [- draft: skip]
job: internal-tools | 0.1.0 · private [- private: skip]
foot: only ready, public packages go on
@step Cache: Each package's hash picks its cache shard.
at lookup
rows
ui-kit ; 3.2.0 | hash = 0x51a2 ; * shard 2 of 8 | => cache: cache shard 2 | a hit ; built before
router ; 1.9.4 | hash = 0x9f07 ; * shard 7 of 8 | => cache: cache shard 7 | ! a miss ; build it
! a miss sends the package on to build
@step Publish: The built package is renamed for the registry.
at publish
map rename
job: router 1.9.4
built from the main branch
to
+ name; + version; + licence; - source maps; - test files
```

Animation: a worksheet

A sheet: lines up values in cells per row, rows in groups, and one outcome column. Steps mark a cell, give each row a value, sum a group (its result goes to the outcome column next) and write the total; note: and = ... are bands under the stage.

Takingsper hour, two shops1 / 5

Takings (per hour, two shops) two shops, each with its own tills (3 tills): shop north (2 tills): till 1: 40, 55, 70, 85, 20, 35, 50 till 2: 10, 20, 30, 40, 50, 60, 70 shop south (1 till): till 3: 100, 130, 160, 190, 220, 250, 280 head office (adds the shops). 1. Counts: Each till's running count, read every 10 minutes. 2. Emptied: A drop means the till was emptied; the count before it is added back. till 1, value 5 (20): bad, +85. till 1 was emptied: 85 then 20 goes down: the till was emptied so 85 is added back 3. Per hour: Each till's increase over the hour. per hour: till 1 95, till 2 60, till 3 180. 4. Shops: Each shop adds its own tills. shop north: 95 + 60 = 155, sends 155. shop south: 180, sends 180. 5. Office: The office adds the shops. head office: 155 + 180 = 335; takings per hour; 335. an emptied till loses nothing

Each till's running count, read every 10 minutes.

Source: `fixtures/stage/03-animation-a-worksheet.dh.md`
text
---
title: "Animation: a worksheet"
description: A fixture made from the Format page section of the same name (a composed stage).
roles:
client: c1
server: c2
store: c3
job: c4
cache: c5
ops: c6
plain: c0
---
## Animation: a worksheet
A `sheet:` lines up values in cells per row, rows in groups, and one outcome column. Steps `mark` a cell, give each row a `value`, `sum` a group (its result goes to the outcome column next) and write the `total`; `note:` and `= ...` are bands under the stage.
```animation
title: Takings | per hour, two shops
sheet: two shops, each with its own tills | 3 tills
server s0: shop north | 2 tills
plain t1 "till 1": 40 55 70 85 20 35 50
plain t2 "till 2": 10 20 30 40 50 60 70
server s1: shop south | 1 till
plain t3 "till 3": 100 130 160 190 220 250 280
=> store out: head office | adds the shops
@step Counts: Each till's running count, read every 10 minutes.
@step Emptied: A drop means the till was emptied; the count before it is added back.
mark t1 5: bad +85
note: till 1 was emptied | 85 then 20 goes down: the till was emptied | so 85 is added back
@step Per hour: Each till's increase over the hour.
value t1 t2 t3: per hour | 95, 60, 180
@step Shops: Each shop adds its own tills.
sum s0: shop north | 95 + 60 = 155 -> 155
sum s1: shop south | 180 -> 180
@step Office: The office adds the shops.
total out: 155 + 180 = 335 => takings per hour | 335
aside out: an emptied till loses nothing
```

Animation: a swimlane matrix

A matrix: crosses lanes (rows) with columns (column id: Title) into cells; each cell holds cards, chips and an "and more" line. light lane.column: words lights a cell with a few words under its contents; show t4 brings a card in and light t3 puts one in focus. Every cell and card has its place from the first step, so nothing moves. A phone stacks the matrix by lane: each lane is a block, with its columns as small headings.

A photo uploadwho does what, stage by stage1 / 4

A photo upload (who does what, stage by stage) Who holds the photo (five parts, four stages). Columns: Submit (the request), Queue (waits for a worker), Run (the work), Report (the answer). Browser (the person): Submit: Upload (4 MB, one file). API (checks and accepts): Submit: Accept (size and type checked). Report: Status (answers polling). Worker (does the slow part): Run: Resize (three sizes); chip strip metadata. Job queue (keeps the order): Queue: Waiting job (first in, first out); and more: about 30 more. Storage (keeps the files): empty. 1. Send: The browser sends the file. Lit: Browser, Submit (the request leaves). In focus: Upload (4 MB, one file) [Browser, Submit]. 2. Accept: The API checks it and queues a job. Now in the matrix: chip 202 [API, Submit]. Lit: API, Submit (202 sent back). Lit: Job queue, Queue (one more waiting). 3. Work: A worker takes the job and writes the sizes. Lit: Worker, Run. Now in the matrix: chip original [Storage, Run]; chip 3 sizes [Storage, Run]. Lit: Storage, Run (files written). 4. Done: The browser polls and shows the result. Now in the matrix: Done page (thumbnail shown) [Browser, Report]. Lit: Browser, Report; API, Report.

The browser sends the file.

Source: `fixtures/stage/04-animation-a-swimlane-matrix.dh.md`
text
---
title: "Animation: a swimlane matrix"
description: A fixture made from the Format page section of the same name (a composed stage).
roles:
client: c1
server: c2
store: c3
job: c4
cache: c5
ops: c6
plain: c0
---
## Animation: a swimlane matrix
A `matrix:` crosses **lanes** (rows) with **columns** (`column id: Title`) into cells; each cell holds cards, chips and an "and more" line. `light lane.column: words` lights a cell with a few words under its contents; `show t4` brings a card in and `light t3` puts one in focus. Every cell and card has its place from the first step, so nothing moves. A phone stacks the matrix by lane: each lane is a block, with its columns as small headings.
```animation
title: A photo upload | who does what, stage by stage
matrix: Who holds the photo | five parts, four stages
column sb: Submit | the request
column qu: Queue | waits for a worker
column rn: Run | the work
column rp: Report | the answer
client c: Browser | the person
sb: [u1] Upload | 4 MB, one file
rp: [u3] Done page | thumbnail shown
server a: API | checks and accepts
sb: [a1] Accept | size and type checked; + [r202] 202
rp: [a2] Status | answers polling
job w: Worker | does the slow part
rn: [w1] Resize | three sizes; + strip metadata
cache k: Job queue | keeps the order
qu: [q1] Waiting job | first in, first out; ... about 30 more
store s: Storage | keeps the files
rn: + [orig] original; + [sizes] 3 sizes
@step Send: The browser sends the file.
light c.sb: the request leaves
light u1
@step Accept: The API checks it and queues a job.
show r202
light a.sb: 202 sent back
light k.qu: one more waiting
@step Work: A worker takes the job and writes the sizes.
light w.rn
show orig, sizes
light s.rn: files written
@step Done: The browser polls and shows the result.
show u3
light c.rp, a.rp
```

Animation: time

A time: block is a real axis: a tick ruler, rows of states, and per step a marker (at) or a bracket over a span (span). Every mark sits at its true place.

A pipelinebuild, then test, then deploy1 / 3

A pipeline (build, then test, then deploy) Time from 0 to 60 seconds: build: queued 0 to 4, running 4 to 31, done 31 to 60 test: queued 0 to 31, running 31 to 52, done 52 to 60 deploy: waiting 0 to 52, rolling 52 to 60 1. Build: The build runs first, for 27 seconds. build, 4 to 31: 27 s. 2. Test: The test starts when the build ends. At 31 seconds: build done. 3. Deploy: The deploy starts at 52 seconds. At 52 seconds: tests pass.

The build runs first, for 27 seconds.

Source: `fixtures/stage/05-animation-time.dh.md`
text
---
title: "Animation: time"
description: A fixture made from the Format page section of the same name (a composed stage).
roles:
client: c1
server: c2
store: c3
job: c4
cache: c5
ops: c6
plain: c0
---
## Animation: time
A `time:` block is a real axis: a tick ruler, rows of states, and per step a marker (`at`) or a bracket over a span (`span`). Every mark sits at its true place.
```animation
title: A pipeline | build, then test, then deploy
time: 0..60 | seconds
row job j1 "build": queued 0..4; +running 4..31; done 31..60
row job j2 "test": queued 0..31; +running 31..52; done 52..60
row server d1 "deploy": waiting 0..52; +rolling 52..60
@step Build: The build runs first, for 27 seconds.
span j1 4..31: 27 s
@step Test: The test starts when the build ends.
at 31: build done
@step Deploy: The deploy starts at 52 seconds.
at 52: tests pass
```

Animation: time up close

The full ruler and an enlarged inset share the same data. The handoff marker stays at 30 seconds, and progress uses a continuous value axis. A narrow page stacks the inset below the overview.

A studio exportprepare, render, deliver1 / 3

A studio export (prepare, render, deliver) Time from 0 to 60 seconds: export: prepare 0 to 24, render 24 to 36, delivered 36 to 60 review: waiting 0 to 30, checking 30 to 45, accepted 45 to 60 Ticks: 0, 15, 30, 45, 60. Zoom 24 to 36: Close-up. Values from 0 to 100 percent complete. Start: 0 at 0. Prepared: 25 at 24. Halfway: 50 at 30. Rendered: 75 at 36. Complete: 100 at 60. Marker 30: 30 s, review starts. 1. Prepare: Preparation takes the first 24 seconds. export, 0 to 24: preparation. 2. Handoff: Review begins halfway through rendering. At 30 seconds: halfway. export, 24 to 36: rendering. 3. Deliver: The export finishes before review ends. At 36 seconds: export complete.

Preparation takes the first 24 seconds.

Source: `fixtures/stage/06-animation-time-up-close.dh.md`
text
---
title: "Animation: time up close"
description: A fixture made from the Format page section of the same name (a composed stage).
roles:
client: c1
server: c2
store: c3
job: c4
cache: c5
ops: c6
plain: c0
---
## Animation: time up close
The full ruler and an enlarged inset share the same data. The handoff marker stays at 30 seconds, and progress uses a continuous value axis. A narrow page stacks the inset below the overview.
```animation
title: A studio export | prepare, render, deliver
time: 0..60 | seconds
ticks: 0, 15, 30, 45, 60
row job export "export": +prepare 0..24; +render 24..36; delivered 36..60
row server review "review": waiting 0..30; +checking 30..45; accepted 45..60
at 30: 30 s, review starts
zoom: 24..36 | Close-up
plot: 0..100 | percent complete
point job start at 0: 0 | Start
point job prepared at 24: 25 | Prepared
point job halfway at 30: 50 | Halfway
point job rendered at 36: 75 | Rendered
point job finish at 60: 100 | Complete
@step Prepare: Preparation takes the first 24 seconds.
span export 0..24: preparation
@step Handoff: Review begins halfway through rendering.
at 30: halfway
span export 24..36: rendering
@step Deliver: The export finishes before review ends.
at 36: export complete
```

Animation: counted units

Each square is one unit. The grid includes the unassigned remainder, so the total can be counted directly.

A sample libraryone square per clip

A sample library (one square per clip) 64 units: kept 16, added 8, removed 4, remaining 36.

Source: `fixtures/stage/07-animation-counted-units.dh.md`
text
---
title: "Animation: counted units"
description: A fixture made from the Format page section of the same name (a composed stage).
roles:
client: c1
server: c2
store: c3
job: c4
cache: c5
ops: c6
plain: c0
---
## Animation: counted units
Each square is one unit. The grid includes the unassigned remainder, so the total can be counted directly.
```animation
title: A sample library | one square per clip
units 64: kept 16, added 8, removed 4
```

Animation: time detail, static

The same real axes can be printed as a selected step. The marker, inset and values keep their places.

A studio exportthe handoff, held still

A studio export (the handoff, held still) Time from 0 to 60 seconds: export: prepare 0 to 24, render 24 to 36, delivered 36 to 60 Zoom 24 to 36: Close-up. Values from 0 to 100 percent complete. Start: 0 at 0. Halfway: 50 at 30. Complete: 100 at 60. Marker 30: 30 s, review starts. 1. Prepare: The first 24 seconds prepare the export. export, 0 to 24: preparation. 2. Handoff: Review begins halfway through rendering. At 30 seconds: halfway.

2 Handoff: Review begins halfway through rendering.

All steps (2)
  1. Prepare: The first 24 seconds prepare the export.
  2. Handoff: Review begins halfway through rendering.
Source: `fixtures/stage/08-animation-time-detail-static.dh.md`
text
---
title: "Animation: time detail, static"
description: A fixture made from the Format page section of the same name (a composed stage).
roles:
client: c1
server: c2
store: c3
job: c4
cache: c5
ops: c6
plain: c0
---
## Animation: time detail, static
The same real axes can be printed as a selected step. The marker, inset and values keep their places.
```animation static=2
title: A studio export | the handoff, held still
time: 0..60 | seconds
row job export "export": +prepare 0..24; +render 24..36; delivered 36..60
at 30: 30 s, review starts
zoom: 24..36 | Close-up
plot: 0..100 | percent complete
point job start at 0: 0 | Start
point job halfway at 30: 50 | Halfway
point job finish at 60: 100 | Complete
@step Prepare: The first 24 seconds prepare the export.
span export 0..24: preparation
@step Handoff: Review begins halfway through rendering.
at 30: halfway
```

Animation: units on a ruler

Every cell is one hour. State changes, markers and spans use the same ruler.

A workshop dayone cell per hour1 / 2

A workshop day (one cell per hour) Time from 0 to 12 hours: batch: queued 0 to 3, working 3 to 9, done 9 to 12 (steps 2 onward) packing: empty 0 to 6 (dashed), hold 6 to 7 (step 1 only, warning), box 6 to 7 (steps 2 onward), packing 7 to 11 (steps 2 onward, good), done 11 to 12 (steps 2 onward) One state cell per hour. Ticks: 0, 3, 6, 9, 12. Marker 6: packing begins. 1. Make: The batch takes six hours to make. batch, 3 to 9: six hours. From this step onward. 2. Pack: Packing overlaps the last three hours of making. At 6 hours: both are active. From this step onward.

The batch takes six hours to make.

Source: `fixtures/stage/09-animation-units-on-a-ruler.dh.md`
text
---
title: "Animation: units on a ruler"
description: A fixture made from the Format page section of the same name (a composed stage).
roles:
client: c1
server: c2
store: c3
job: c4
cache: c5
ops: c6
plain: c0
---
## Animation: units on a ruler
Every cell is one hour. State changes, markers and spans use the same ruler.
```animation
title: A workshop day | one cell per hour
time: 0..12 | hours
cells: 1
ticks: 0, 3, 6, 9, 12
row job batch "batch": queued 0..3; +working 3..9; done 9..12 @2
row server pack "packing": _ 0..6 [dashed]; hold 6..7 @1 [warn]; +box 6..7 @2 [lit]; packing 7..11 @2 [good]; done 11..12 @2
at 6: packing begins
@step Make: The batch takes six hours to make.
keep span batch 3..9 [warn]: six hours
@step Pack: Packing overlaps the last three hours of making.
keep at 6 [bad]: both are active
```

Animation: counted pieces beside a card

Counted rows can sit beside another step panel. The role before the parentheses colours the squares; the role inside colours the badge. Plain and muted text follow the counts.

A copy deskcounted pieces1 / 2

A copy desk (counted pieces) 1. Leaving: Some pieces are leaving each desk. Draft (A copy remains here.). Stored pieces: job (client): 12 units, kept 8, leaving 4. job (server): 12 units, kept 10, leaving 2. One square is one piece. c, the client desk: 8 kept, 4 leaving. s, the server desk: 10 kept, 2 leaving. Thick borders show departing pieces. 2. Gone: The departed pieces are faint. Draft (The retained copy is ready.). Stored pieces: job (client): 12 units, kept 8, gone 4. job (server): 12 units, kept 10, gone 2. One square is one piece. c, the client desk: 8 kept, 4 gone. s, the server desk: 10 kept, 2 gone. Faint squares show departed pieces.

Some pieces are leaving each desk.

Source: `fixtures/stage/14-animation-counted-pieces-beside-a-card.dh.md`
text
---
title: "Animation: counted pieces beside a card"
description: A fixture made from the Format page section of the same name (a composed stage).
roles:
client: c1
server: c2
store: c3
job: c4
cache: c5
ops: c6
plain: c0
---
## Animation: counted pieces beside a card
Counted rows can sit beside another step panel. The role before the parentheses colours the squares; the role inside colours the badge. Plain and muted text follow the counts.
```animation
title: A copy desk | counted pieces
@step Leaving: Some pieces are leaving each desk.
card job: Draft | A copy remains here.
beside
units Stored pieces | One square is one piece.
job (client) 12: kept 8, leaving 4
job (server) 12: kept 10, leaving 2
c, the client desk: 8 kept, 4 leaving.
s, the server desk: 10 kept, 2 leaving.
~ Thick borders show departing pieces.
@step Gone: The departed pieces are faint.
card job: Draft | The retained copy is ready.
beside
units Stored pieces | One square is one piece.
job (client) 12: kept 8, gone 4
job (server) 12: kept 10, gone 2
c, the client desk: 8 kept, 4 gone.
s, the server desk: 10 kept, 2 gone.
~ Faint squares show departed pieces.
```

Animation: cards inside cards

A card line indented under a card is a card inside it (one level). The outer card is as tall as what it holds, and a connector to or from an inner card starts or ends at the card that holds it, so no line crosses a card. A title may end in a state word, [+ open] (good) or [- shut] (bad), that a step changes with state; text id: line | line gives a card new lines from that step on; dashed draws a card that is not there yet, and dashed id off makes it solid. ## Desk across Branches..Readers is a band whose cards run left to right in one row; a line next row starts the row under them, centred.

A librarybooks between branches1 / 3

A library (books between branches) Branches: main branch (two floors; open late), holding: ground floor (open; returns desk); top floor (shut; reading room). Vans: book van (one driver), holding: morning run (8 stops); evening run (5 stops). Readers: readers, holding: card holder (borrows 3); new reader (no card yet). Desk (across Branches to Readers): check in; shelve; lend; repair. 1. Morning: Books leave the main branch on the morning van. 40 books: ground floor to book van. drop-off: morning run to readers. new reader is dashed (not there yet). 2. Evening: The top floor opens and a new reader joins. new reader: joined. evening run says: runs late tonight and comes back by ten; one driver. evening run says: no stops on the hill. evening run now reads: 5 stops; and the late club. top floor: open. new reader is solid. 3. Desk: Every book goes through the desk, one step at a time. next: check in to shelve, shelve to lend (dashed). mended: repair to shelve. The earlier connectors are gone.

Books leave the main branch on the morning van.

Source: `fixtures/stage/15-animation-cards-inside-cards.dh.md`
text
---
title: "Animation: cards inside cards"
description: A fixture made from the Format page section of the same name (a composed stage).
roles:
client: c1
server: c2
store: c3
job: c4
cache: c5
ops: c6
plain: c0
---
## Animation: cards inside cards
A card line indented under a card is a card **inside** it (one level). The outer card is as tall as what it holds, and a connector to or from an inner card starts or ends at the card that holds it, so no line crosses a card. A title may end in a state word, `[+ open]` (good) or `[- shut]` (bad), that a step changes with `state`; `text id: line | line` gives a card new lines from that step on; `dashed` draws a card that is not there yet, and `dashed id off` makes it solid. `## Desk across Branches..Readers` is a band whose cards run left to right in one row; a line `next row` starts the row under them, centred.
```animation
title: A library | books between branches
## Branches
store h: main branch | two floors | open late
store f1: ground floor [+ open] | returns desk
store f2: top floor [- shut] | reading room
## Vans
job v: book van | one driver
job v1: morning run | 8 stops
job v2: evening run | 5 stops
## Readers
client r: readers
client r1: card holder | borrows 3
client r2: new reader | no card yet
## Desk across Branches..Readers
ops a: check in
ops b: shelve
ops c: lend
next row
ops d: repair
@step Morning: Books leave the main branch on the morning van.
dashed r2
f1 -> v: 40 books
v1 -> r: drop-off
@step Evening: The top floor opens and a new reader joins.
state f2: [+ open]
text v2: 5 stops | and the late club
dashed r2 off
tag r2: joined
say v2: runs late tonight and comes back by ten | one driver
say v2: no stops on the hill
@step Desk: Every book goes through the desk, one step at a time.
clear
a --> b: next
b --> c: next
d -> b: mended
```

Animation: pills that move

pill ids: words; words under a card stacks pills at its foot. move p3 to w draws the pill in the other card from that step on; both cards keep a place for it, so nothing else moves. light p1: note lights a pill with a note at its right end, tone id bad (or good, warn, accent, off) and dim id change a card from that step on, and align: top gives the cards of a row one top and one foot.

Bakery shelvestrays move as they sell1 / 3

Bakery shelves (trays move as they sell) Oven: oven (batch 1); timer (20 minutes). Shelf A: shelf A (by the door) pills: rye · fresh; spelt · fresh; oat · cooling. Shelf B: shelf B (at the back) pills: seed · fresh. Window: window (on the street) pills: brioche · on show. 1. Bake: The oven fills shelf A. trays: oven to shelf A. 2. Sell: Rye sells out and the oat loaf moves to the window. shelf A now reads: rye is gone; spelt stays. the pill "rye · fresh" fades. oat · cooling moves to window. rye · fresh: sold. 3. Late: Shelf B runs low and closes; the timer is off. shelf B now reads: closed for the night. shelf B is in trouble. timer fades.

The oven fills shelf A.

Source: `fixtures/stage/16-animation-pills-that-move.dh.md`
text
---
title: "Animation: pills that move"
description: A fixture made from the Format page section of the same name (a composed stage).
roles:
client: c1
server: c2
store: c3
job: c4
cache: c5
ops: c6
plain: c0
---
## Animation: pills that move
`pill ids: words; words` under a card stacks pills at its foot. `move p3 to w` draws the pill in the other card from that step on; both cards keep a place for it, so nothing else moves. `light p1: note` lights a pill with a note at its right end, `tone id bad` (or `good`, `warn`, `accent`, `off`) and `dim id` change a card from that step on, and `align: top` gives the cards of a row one top and one foot.
```animation
title: Bakery shelves | trays move as they sell
align: top
## Oven
job o: oven | batch 1
cache t: timer | 20 minutes
## Shelf A
server sa: shelf A | by the door
pill p1,p2,p3: rye · fresh; spelt · fresh; oat · cooling
## Shelf B
server sb: shelf B | at the back
pill p4: seed · fresh
## Window
client w: window | on the street
pill p5: brioche · on show
@step Bake: The oven fills shelf A.
o -> sa: trays
@step Sell: Rye sells out and the oat loaf moves to the window.
move p3 to w
light p1: sold
dim p1
text sa: rye is gone | spelt stays
@step Late: Shelf B runs low and closes; the timer is off.
tone sb bad
dim t
text sb: closed for the night
```

Animation: token chips and a record

tokens: ... under a card lays out its words as chips, in order, wrapped. mark id word, word: tone remark boxes some in a tone for that step only, with the remark under their row (a word with a comma is named without it, or by its place, #3). keys: A; B makes the card a record whose values read ... until a step fills them: fill id A, B: value; value. The record keeps its size on every step.

Reading a recipe linewords become a plan1 / 4

Reading a recipe line (words become a plan) Also: the line tokens: mix ( flour, sugar, salt ) then bake ( 180C, 25min ); the plan {Action: ...; Inputs: ...; Then: ...; Heat: ...; Time: ...}. 1. Read: The line is read word by word; the plan is still empty. 2. Mix: The first call names what to mix. the line: mix, flour, sugar, salt (accent). the plan: Action = mix, Inputs = flour, sugar, salt. 3. Drop: Salt is optional here, so it is dropped. the line: salt (bad: dropped: optional). the plan: Inputs = flour, sugar. 4. Bake: Then the oven, hot and for a time. the line: bake, 180C, 25min (accent). the plan: Then = bake, Heat = 180C, Time = 25 minutes.

The line is read word by word; the plan is still empty.

Source: `fixtures/stage/17-animation-token-chips-and-a-record.dh.md`
text
---
title: "Animation: token chips and a record"
description: A fixture made from the Format page section of the same name (a composed stage).
roles:
client: c1
server: c2
store: c3
job: c4
cache: c5
ops: c6
plain: c0
---
## Animation: token chips and a record
`tokens: ...` under a card lays out its words as chips, in order, wrapped. `mark id word, word: tone remark` boxes some in a tone for that step only, with the remark under their row (a word with a comma is named without it, or by its place, `#3`). `keys: A; B` makes the card a record whose values read `...` until a step fills them: `fill id A, B: value; value`. The record keeps its size on every step.
```animation
title: Reading a recipe line | words become a plan
## _
plain q: the line
tokens: mix ( flour, sugar, salt ) then bake ( 180C, 25min )
store r: the plan
keys: Action; Inputs; Then; Heat; Time
@step Read: The line is read word by word; the plan is still empty.
@step Mix: The first call names what to mix.
mark q mix, flour, sugar, salt: accent
fill r Action, Inputs: mix; flour, sugar, salt
@step Drop: Salt is optional here, so it is dropped.
mark q salt: bad dropped: optional
fill r Inputs: flour, sugar
@step Bake: Then the oven, hot and for a time.
mark q bake, 180C, 25min: accent
fill r Then, Heat, Time: bake; 180C; 25 minutes
```

Animation: two arrows, one label each

A connector line of one pair keeps its own label: two lines that both say 30 crates show it on both arrows. A line of several pairs, m -> s, t: 12 each, shows its label once for the bundle, and so do such lines with one label across one gap.

A market morningcrates in, crates out1 / 3

A market morning (crates in, crates out) Farms: hill farm (apples); river farm (pears). Market: market hall (one floor). Shops: corner shop; station kiosk. 1. Arrive: Both farms bring the same load. 30 crates: hill farm to market hall, river farm to market hall. 2. Share: The hall sends some on, the same to each shop. 12 each: market hall to corner shop, market hall to station kiosk. 3. Again: Next morning the hill farm comes again with the same load. 30 crates: hill farm to market hall. The earlier connectors are gone.

Both farms bring the same load.

Source: `fixtures/stage/18-animation-two-arrows-one-label-each.dh.md`
text
---
title: "Animation: two arrows, one label each"
description: A fixture made from the Format page section of the same name (a composed stage).
roles:
client: c1
server: c2
store: c3
job: c4
cache: c5
ops: c6
plain: c0
---
## Animation: two arrows, one label each
A connector line of one pair keeps its own label: two lines that both say `30 crates` show it on both arrows. A line of several pairs, `m -> s, t: 12 each`, shows its label once for the bundle, and so do such lines with one label across one gap.
```animation
title: A market morning | crates in, crates out
## Farms
job a: hill farm | apples
job b: river farm | pears
## Market
store m: market hall | one floor
## Shops
client s: corner shop
client t: station kiosk
@step Arrive: Both farms bring the same load.
a -> m: 30 crates
b -> m: 30 crates
@step Share: The hall sends some on, the same to each shop.
m -> s, t: 12 each
@step Again: Next morning the hill farm comes again with the same load.
clear
a -> m: 30 crates
```

Animation: a key

With the setup line key at: top right, the scene's key role: words; words entries form a legend at the stage's top right, each a small swatch in the role's colour with its words beside it. An entry shows from the step that writes it; its place is kept from the start, so nothing moves. Without that line the key stays at the bottom left.

A bike shopparts in, bikes out1 / 2

A bike shop (parts in, bikes out) Store room: parts shelf (wheels, chains). Bench: fitter (one bench). Door: rider. 1. Parts: The fitter takes parts from the shelf. two wheels: parts shelf to fitter. Key (store): kept in stock. Key (job): work done here. 2. Ride: The bike goes out of the door. one bike: fitter to rider. Key (client): who it is for.

The fitter takes parts from the shelf.

Source: `fixtures/stage/19-animation-a-key.dh.md`
text
---
title: "Animation: a key"
description: A fixture made from the Format page section of the same name (a composed stage).
roles:
client: c1
server: c2
store: c3
job: c4
cache: c5
ops: c6
plain: c0
---
## Animation: a key
With the setup line `key at: top right`, the scene's `key role: words; words` entries form a legend at the stage's top right, each a small swatch in the role's colour with its words beside it. An entry shows from the step that writes it; its place is kept from the start, so nothing moves. Without that line the key stays at the bottom left.
```animation
title: A bike shop | parts in, bikes out
key at: top right
## Store room
store p: parts shelf | wheels, chains
## Bench
job f: fitter | one bench
## Door
client c: rider
@step Parts: The fitter takes parts from the shelf.
p -> f: two wheels
key store: kept in stock
key job: work done here
@step Ride: The bike goes out of the door.
f -> c: one bike
key client: who it is for
```

Animation: boxes inside boxes

A nest: draws wrappers as boxes inside boxes, outside first, each with a role, a title, a size and its fields; a field after > sits at the box's end, under what it holds. Every box has its place from the first step, so a wrapper put round later, or taken off, moves nothing. A step can show a wrapper, light it or one of its fields, give it new fields or a new title, set one field (the old value struck beside the new one, for that step), unwrap it (the wrapper comes off what it holds: dashed and struck for that step, then gone) or hide it. Fields are written in the mono face, so they line up.

A parcelwrapped for the trip, unwrapped at the door1 / 4

A parcel (wrapped for the trip, unwrapped at the door) The parcel (outside in): - shipping crate (store), 40 kg, from step 2: to the depot; from the warehouse; seal 7731 - box (job), 2 kg: to the house; status: packed - gift (client), a mug: wrapped in paper 1. Boxed: The gift goes in a box addressed to the house. Lit: gift. 2. Crated: The box rides in a crate addressed to the depot, not to the house. shipping crate is put round what it holds. Lit: to the depot (shipping crate). 3. At the depot: The crate comes off; the box goes on the van. shipping crate is taken off. box: status: packed becomes status: out for delivery. 4. At the door: The box comes off, and the gift is there. box is taken off. Lit: gift.

The gift goes in a box addressed to the house.

The full example, one web request through a switch, a home router and two internet routers and back, is its own page: the layers, through several routers.

Source: `fixtures/stage/20-animation-boxes-inside-boxes.dh.md`
text
---
title: "Animation: boxes inside boxes"
description: A fixture made from the Format page section of the same name (a composed stage).
roles:
client: c1
server: c2
store: c3
job: c4
cache: c5
ops: c6
plain: c0
---
## Animation: boxes inside boxes
A `nest:` draws wrappers as boxes inside boxes, outside first, each with a role, a title, a size and its fields; a field after `> ` sits at the box's end, under what it holds. Every box has its place from the first step, so a wrapper put round later, or taken off, moves nothing. A step can `show` a wrapper, `light` it or one of its fields, give it new `fields` or a new `title`, `set` one field (the old value struck beside the new one, for that step), `unwrap` it (the wrapper comes off what it holds: dashed and struck for that step, then gone) or `hide` it. Fields are written in the mono face, so they line up.
```animation
title: A parcel | wrapped for the trip, unwrapped at the door
nest: The parcel | outside in
store crate: shipping crate | 40 kg | to the depot; from the warehouse; > seal 7731
job box: box | 2 kg | to the house; status: packed
client gift: gift | a mug | wrapped in paper
@step Boxed: The gift goes in a box addressed to the house.
light gift
@step Crated: The box rides in a crate addressed to the depot, not to the house.
show crate
light crate: to the depot
@step At the depot: The crate comes off; the box goes on the van.
unwrap crate
set box: status: packed => status: out for delivery
@step At the door: The box comes off, and the gift is there.
unwrap box
light gift
```
The full example, one web request through a switch, a home router and two internet routers and back, is its own page: [the layers, through several routers](../layers/).

Animation: counted columns

A columns block is a dot histogram: one column per category, one dot per counted thing, stacked from the bottom. The columns' places are kept for the widest step, so adding columns moves nothing; new lights columns in the step that adds them.

A lending libraryone dot per book returned1 / 3

A lending library (one dot per book returned) Columns: books returned each month, one dot each, in their month's column (one dot per book), up to 12 columns. 1. First half: Six months: 12 to 31 books a month. 6 columns, 135 books in all (12 to 31 a column): Jan 24, Feb 19, Mar 31, Apr 22, May 27, Jun 12. 2. The year: The second half adds six columns; the summer months are quiet. 12 columns, 274 books in all (9 to 35 a column): Jan 24, Feb 19, Mar 31, Apr 22, May 27, Jun 12, Jul 9, Aug 11, Sep 28, Oct 30, Nov 26, Dec 35. New: Jul, Aug, Sep, Oct, Nov, Dec (139 in them). 3. December: December is the busiest month of the year. Lit, unchanged since the step before: Dec 35.

Six months: 12 to 31 books a month.

Source: `fixtures/stage/21-animation-counted-columns.dh.md`
text
---
title: "Animation: counted columns"
description: A fixture made from the Format page section of the same name (a composed stage).
roles:
client: c1
server: c2
store: c3
job: c4
cache: c5
ops: c6
plain: c0
---
## Animation: counted columns
A `columns` block is a dot histogram: one column per category, one dot per counted thing, stacked from the bottom. The columns' places are kept for the widest step, so adding columns moves nothing; `new` lights columns in the step that adds them.
```animation
title: A lending library | one dot per book returned
columns 12 store: books returned each month, one dot each, in their month's column | books
every 3
labels: Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec
@step First half: Six months: 12 to 31 books a month.
counts 6: 24, 19, 31, 22, 27, 12
@step The year: The second half adds six columns; the summer months are quiet.
counts 12: 24, 19, 31, 22, 27, 12, 9, 11, 28, 30, 26, 35
light Jul..Dec
@step December: December is the busiest month of the year.
light Dec
```

Animation: a bar chart in a scene

A bars block is a small bar chart on one value axis: grid values, reference lines, and per step new values, a dotted peak line, a dashed limit (bars over it light up in its step), and moves from one bar to others, drawn as dashed arrows with the moved amount stacked on the taker. Every bar top and line sits at its true value.

A cafécups sold, by day1 / 4

A café (cups sold, by day) Bars: day of the week · bar = cups sold ÷ the weekly average (×), 7 bars, axis 0, 0.5, 1, 1.5. Tabs: One barista (steps 1 to 3), Two baristas (step 4). Line average at 1. 1. Busy Friday: Friday sells 1.4 times the average day. Tab: One barista. cups by day · the week of 3 March. Values: Mon 0.7, Tue 0.8, Wed 0.9, Thu 1, Fri 1.4, Sat 1.3, Sun 0.9. Peak: busiest 1.4×. 1.4×: busiest ÷ average. Lit bars: Fri 1.4 (the peak). 2. A cap: No day should go over 1.2 times the average; two days do. cap = 1.2 × the average · 2 days are over it. Limit 1.2: cap 1.2×. Lit bars: Fri 1.4 (the peak), Sat 1.3 (over the limit). 3. Move orders: Friday and Saturday hand pre-orders to Monday and Tuesday. the moves: Fri → Mon (2 trays), Sat → Tue (1 tray) · the week's total does not change. Values: Mon 0.9, Tue 0.9, Wed 0.9, Thu 1, Fri 1.2, Sat 1.2, Sun 0.9. Peak: busiest 1.2×. 1.2×: busiest ÷ average. Moves: Fri to Mon (2), Sat to Tue (1). Lit bars: Mon 0.9 (takes), Tue 0.9 (takes), Fri 1.2 (the peak; at the limit), Sat 1.2 (the peak; at the limit). 4. Two baristas: Saturday remains the busiest day; Friday is also above average. Tab: Two baristas. two baristas, a month later. Values: Mon 0.9, Tue 0.9, Wed 1, Thu 1, Fri 1.1, Sat 1.2, Sun 0.9. Lit bars: Sat 1.2 (lit: the busiest; at the limit).

Friday sells 1.4 times the average day.

Source: `fixtures/stage/22-animation-a-bar-chart-in-a-scene.dh.md`
text
---
title: "Animation: a bar chart in a scene"
description: A fixture made from the Format page section of the same name (a composed stage).
roles:
client: c1
server: c2
store: c3
job: c4
cache: c5
ops: c6
plain: c0
---
## Animation: a bar chart in a scene
A `bars` block is a small bar chart on one value axis: grid values, reference lines, and per step new values, a dotted peak line, a dashed limit (bars over it light up in its step), and moves from one bar to others, drawn as dashed arrows with the moved amount stacked on the taker. Every bar top and line sits at its true value.
```animation
title: A café | cups sold, by day
bars 7 server: day of the week · bar = cups sold ÷ the weekly average | ×
axis 0, 0.5, 1, 1.5
line average: 1
labels: Mon, Tue, Wed, Thu, Fri, Sat, Sun
tabs One barista: 1..3; Two baristas: 4
@step Busy Friday: Friday sells 1.4 times the average day.
values: 0.7 0.8 0.9 1.0 1.4 1.3 0.9
peak: busiest 1.4×
heading: cups by day | the week of 3 March
big: 1.4× | busiest ÷ average
@step A cap: No day should go over 1.2 times the average; two days do.
limit 1.2: cap 1.2×
heading: cap = 1.2 × the average · 2 days are over it
@step Move orders: Friday and Saturday hand pre-orders to Monday and Tuesday.
values: 0.9 0.9 0.9 1.0 1.2 1.2 0.9
move 2 from Fri to Mon; 1 from Sat to Tue
peak: busiest 1.2×
big: 1.2× | busiest ÷ average
heading: the moves: Fri → Mon (2 trays), Sat → Tue (1 tray) | the week's total does not change
@step Two baristas: Saturday remains the busiest day; Friday is also above average.
values: 0.9 0.9 1.0 1.0 1.1 1.2 0.9
light Sat: the busiest
heading: two baristas, a month later
```

Animation: a package journey

A standalone phase strip connects every adjacent phase, including links that wrap to another row on a phone.

A package journeyfetch through publish1 / 3

A package journey (fetch through publish) Phases: fetch, resolve, lookup, build, test, publish. 1. Resolve: The package starts with its dependencies. At: resolve (carrying one package). 2. Cache: The cache answers. At: lookup (carrying one package). 3. Publish: The package reaches the registry. At: publish (carrying one package).

The package starts with its dependencies.

Source: `fixtures/stage/24-animation-a-package-journey.dh.md`
text
---
title: "Animation: a package journey"
description: A fixture made from the Format page section of the same name (a composed stage).
roles:
client: c1
server: c2
store: c3
job: c4
cache: c5
ops: c6
plain: c0
---
## Animation: a package journey
A standalone phase strip connects every adjacent phase, including links that wrap to another row on a phone.
```animation
title: A package journey | fetch through publish
track: job fetch, resolve | cache lookup | job build, test | store publish
carry: one package
@step Resolve: The package starts with its dependencies.
at resolve
@step Cache: The cache answers.
at lookup
@step Publish: The package reaches the registry.
at publish
```

Animation: bins

A bins: block sorts an inventory into named bins. items p1..p8: words names the things (one label for all, or one per id split by ;); items 40: word is a count with no names, drawn as small squares. Each bin role id "Label": the rule | a second line is one bin, coloured by its role. In a step, into <bin>: p1, p2..p4 drops those things, or into <bin>: 12 drops the next 12 left. The block works out the count of each bin, the leftover in the inventory and a running total, and draws them: every thing has one place in the inventory and one reserved slot in its bin, so nothing moves between steps. A narrow screen stacks the bins.

Library returnsone trolley run1 / 4

Library returns (one trolley run) Returned books: 9 books in the inventory (Atlas, Birds, Cooking, Dunes, Engines, Fungi, Gardens, Harbours, Insects). Bins: Science (shelves 500 to 599); Reference (stays in the building); Home (goes back to a branch). 1. Science: Natural history goes to the science shelves. Into Science: Birds, Dunes, Fungi, Insects (4 in it now). Total: 4 of 9 in bins, 5 left. 2. Reference: Two heavy books stay in the building. Into Reference: Atlas, Engines (2 in it now). Total: 6 of 9 in bins, 3 left. 3. Branch: Three go back to a branch. Into Home: Cooking, Gardens, Harbours (3 in it now). Total: 9 of 9 in bins, 0 left. 4. Done: Every book has a bin; the inventory is empty.

Natural history goes to the science shelves.

The same block with many unnamed things: each square is one thing, the counts do the talking.

Seed packets60 packets, sorted by season1 / 3

Seed packets (60 packets, sorted by season) Packets by season: 60 packets in the inventory. Bins: Spring (sow in March); Summer (sow in June); Autumn (sow in September). 1. Spring: The first batch is spring seed. Into Spring: 24 packets (24 in it now). Total: 24 of 60 in bins, 36 left. 2. Summer: Then summer seed. Into Summer: 20 packets (20 in it now). Total: 44 of 60 in bins, 16 left. 3. Autumn: Twelve go to autumn; four are left over. Into Autumn: 12 packets (12 in it now). Total: 56 of 60 in bins, 4 left.

The first batch is spring seed.

A thing can drop again in a later step: it moves to another bin, and its old place stays as a dashed outline. show c in step 2 makes bin c appear there (its place is reserved from the start); light c: words lights a bin with a note in it. ledger: Photo | Album (or ... | Album from 0 to number the bins from 0) adds a list of every thing with the number of its bin in each step; a move reads 1 → 3 in the warning tone. A long label wraps inside its chip; it is never cut. inventory: off drops the inventory frame when everything is binned in step 1.

Photo albumsnine photos, re-sorted1 / 2

Photo albums (nine photos, re-sorted) Albums: 9 photos (Beach · sunny, Beach · dusk, Hike · summit, Hike · lake, City · night, City · market, Beach · kite, Hike · camp, City · bridge). Bins: 1. Album 1 (the first sort); 2. Album 2 (the first sort); 3. Album 3 (added in step 2), from step 2. 1. Two albums: Nine photos sit in two albums. Into Album 1: Beach · sunny, Beach · dusk, Beach · kite, Hike · summit, Hike · lake (5 in it now). Into Album 2: City · night, City · market, Hike · camp, City · bridge (4 in it now). Total: 9 of 9 in bins, 0 left. 2. Three albums: A third album appears and four photos move to it. Album 3 comes in. Into Album 3: Hike · summit, Hike · lake, Hike · camp, City · bridge (4 in it now; moved from Album 1, Album 2: Hike · summit, Hike · lake, Hike · camp, City · bridge). Total: 9 of 9 in bins, 0 left. Album 3: four photos move here.

Nine photos sit in two albums.

Source: `fixtures/stage/34-animation-bins.dh.md`
text
---
title: "Animation: bins"
description: A fixture made from the Format page section of the same name (a composed stage).
roles:
client: c1
server: c2
store: c3
job: c4
cache: c5
ops: c6
plain: c0
---
## Animation: bins
A `bins:` block sorts an inventory into named bins. `items p1..p8: words` names the things (one label for all, or one per id split by `;`); `items 40: word` is a count with no names, drawn as small squares. Each `bin role id "Label": the rule | a second line` is one bin, coloured by its role. In a step, `into <bin>: p1, p2..p4` drops those things, or `into <bin>: 12` drops the next 12 left. The block works out the count of each bin, the leftover in the inventory and a running total, and draws them: every thing has one place in the inventory and one reserved slot in its bin, so nothing moves between steps. A narrow screen stacks the bins.
```animation
title: Library returns | one trolley run
bins: Returned books | books
items b1..b9: Atlas; Birds; Cooking; Dunes; Engines; Fungi; Gardens; Harbours; Insects
bin job s "Science": shelves 500 to 599
bin store r "Reference": stays in the building
bin ops h "Home": goes back to a branch
@step Science: Natural history goes to the science shelves.
into s: b2, b4, b6, b9
@step Reference: Two heavy books stay in the building.
into r: b1, b5
@step Branch: Three go back to a branch.
into h: b3, b7, b8
@step Done: Every book has a bin; the inventory is empty.
```
The same block with many unnamed things: each square is one thing, the counts do the talking.
```animation
title: Seed packets | 60 packets, sorted by season
bins: Packets by season | packets
items 60: packet
bin job a "Spring": sow in March
bin store b "Summer": sow in June
bin ops c "Autumn": sow in September
@step Spring: The first batch is spring seed.
into a: 24
@step Summer: Then summer seed.
into b: 20
@step Autumn: Twelve go to autumn; four are left over.
into c: 12
```
A thing can drop again in a later step: it **moves** to another bin, and its old place stays as a dashed outline. `show c` in step 2 makes bin c appear there (its place is reserved from the start); `light c: words` lights a bin with a note in it. `ledger: Photo | Album` (or `... | Album from 0` to number the bins from 0) adds a list of every thing with the number of its bin in each step; a move reads `1 → 3` in the warning tone. A long label wraps inside its chip; it is never cut. `inventory: off` drops the inventory frame when everything is binned in step 1.
```animation
title: Photo albums | nine photos, re-sorted
bins: Albums | photos
items p1..p9: Beach · sunny; Beach · dusk; Hike · summit; Hike · lake; City · night; City · market; Beach · kite; Hike · camp; City · bridge
bin job a "Album 1": the first sort
bin store b "Album 2": the first sort
bin ops c "Album 3": added in step 2
ledger: Photo | Album
inventory: off
@step Two albums: Nine photos sit in two albums.
into a: p1, p2, p7, p3, p4
into b: p5, p6, p8, p9
@step Three albums: A third album appears and four photos move to it.
show c
light c: four photos move here
into c: p3, p4, p8, p9
```

Every folder part

<!-- generated by scripts/parts.ts from the folders under src/parts/: do not edit -->

The folder parts

Every part that lives in its own folder, with its sample. The Format page shows each as source, drawing and LLM view.

Audio

An audio part is a player of our own. The wave is drawn from a small peaks file and moves with the sound; chapters split it, a marker flags one moment, and the transcript follows the voice.

A page that talksWelcome
0:00/0:57

wave=mirror reflects the wave, wave=dots draws it in dots, wave=live shows a window of the sound that scrolls past "now", and compact makes one row. The colour is a word (tone=c4), never a hex value.

Mirror wave, in family colour 4 
0:00/0:57
0:00/0:57

Calendar

The host supplies no clock here: Today returns to the authored date. Explore the views, switch calendars and open events. A narrow part starts with three days.

Release week
Mon23
Tue24
Wed25
Thu26
Fri27
Sat28
Sun29
all day
01:0002:0003:0004:0005:0006:0007:0008:0009:0010:0011:0012:0013:0014:0015:0016:0017:0018:0019:0020:0021:0022:0023:00

Arrows move by a day or a week · d w m l change the view · t is today

The static form keeps a complete dated list without controls.

Release checklist

Europe/London

  1. Stand-upTeam
  2. Stand-upTeam
  3. Code freeze
  4. Stand-upTeam

Chart kinds

Eight more kinds of a chart, each a YAML map with kind: at the top: raw values are counted, quartiled or smoothed when the page is built, so a model reads the table. Hover, tap or focus a bin, box, stage, block or day for its card; the arrow keys walk the data.

How long a request takes
Show the numbers as a table
fromtocount
25 ms38.83 ms1
38.83 ms52.67 ms2
52.67 ms66.5 ms3
66.5 ms80.33 ms7
80.33 ms94.17 ms11
94.17 ms108 ms5
108 ms121.83 ms7
121.83 ms135.67 ms4
135.67 ms149.5 ms1
149.5 ms163.33 ms1
163.33 ms177.17 ms1
177.17 ms191 ms1
Checkout time by day
Show the numbers as a table
categoryminp25medianp75maxoutliers
Mon1m 40s1m 51s2m 3s2m 14s2m 49s2m 49s
Tue1m 57s2m 13s2m 25s2m 33s2m 56snone
Wed1m 56s2m 17s2m 36s2m 42s4m 20s4m 20s
Response time by service
Show the numbers as a table
categoryminp25medianp75maxoutliers
api57 ms90.5 ms101 ms105 ms124 ms57 ms
search119 ms148.25 ms169 ms204 ms237 msnone
checkout201 ms213 ms240.5 ms247.75 ms262 msnone
From visit to paid
Visited the site48,200100%−82.0%Created an account8,70018.0%−52.9%Started a trial4,100−67.1%Paid1,350
1Last quarter.
1 / 2
Show the numbers as a table
stagecountof the firstof the one before
Visited the site48,200100%
Created an account8,70018.0%18.0%
Started a trial4,1008.5%47.1%
Paid1,3502.8%32.9%
Monthly revenue bridge
€84K+€12.5K−€9.1K−€2.3K€85.1K+€4.8K€89.9K
Show the numbers as a table
stepchangerunning total
October€84,000€84,000
New€12,500€96,500
Churn-€9,100€87,400
Refunds-€2,300€85,100
Subtotaltotal€85,100
Price rise€4,800€89,900
Novembertotal€89,900
Where the disk went

Click or tap a block with a path to open it; the path above takes you back.

Show the numbers as a table
namevaluesharepath
Media556.9 GiB65.6%Media
· Videos383.7 GiB45.2%Media / Videos
· Photos173.2 GiB20.4%Media / Photos
Code162.1 GiB19.1%Code
· Repos80.1 GiB9.4%Code / Repos
· Build cache82 GiB9.6%Code / Build cache
Backups130.4 GiB15.4%Backups
Lines of code by team and area (thousands)
All341

Click or tap a ring to open it; the centre or the path above takes you back.

Show the numbers as a table
namevaluesharepath
Platform15946.6%Platform
· Runtime9327.3%Platform / Runtime
· Storage6619.4%Platform / Storage
Product16448.1%Product
· Web9527.9%Product / Web
· Mobile6920.2%Product / Mobile
Docs185.3%Docs
Commits, September to November
SepOctNov

Swipe the days sideways; arrow keys move between days.

Show the numbers as a table
datevalue
2026-09-017
2026-09-026
2026-09-035
2026-09-074
2026-09-092
2026-09-122
2026-09-144
2026-09-1510
2026-09-161
2026-09-173
2026-09-185
2026-09-218
2026-09-239
2026-09-245
2026-09-253
2026-09-262
2026-09-271
2026-09-289
2026-09-298
2026-09-307
2026-10-018
2026-10-029
2026-10-041
2026-10-055
2026-10-069
2026-10-112
2026-10-129
2026-10-139
2026-10-155
2026-10-166
2026-10-171
2026-10-181
2026-10-208
2026-10-213
2026-10-226
2026-10-236
2026-10-241
2026-10-251
2026-10-262
2026-10-297
2026-10-307
2026-10-311
2026-11-010
2026-11-044
2026-11-065
2026-11-070
2026-11-080
2026-11-092
2026-11-112
2026-11-126
2026-11-138
2026-11-142
2026-11-150
2026-11-168
2026-11-176
2026-11-183
2026-11-191
2026-11-212
2026-11-222
2026-11-233
2026-11-248
2026-11-267
2026-11-2710
2026-11-280
2026-11-291
2026-11-307

Each kind takes title, tone where it makes sense, y: { label, format, currency } for the value axis (the histogram's is x), and steps: that change data, marks or bins from one step to the next.

Compare

A comparison matrix puts options side by side, one line for each thing you judge them on. The first line names the options; every other line is a criterion and one value for each option, in the same order. A note in round brackets shows when a reader hovers, focuses or taps the value. With winner=on the best value of each yes/no, scored or good/bad row is marked; pick= flags the option you recommend.

Which queue?
CriterionRedis Streams5 best · mostOur pickKafka3 bestSQS3 best
Ordering
YesBest in this row
YesBest in this row
Runs itself
No
No
YesBest in this row
Throughput
3
5Best in this row
3
Latency lower is better
12 ms
25 ms
Replay old messages
No
Cost at our size
GoodBest in this row
Bad
Team knows it
YesBest in this row
YesBest in this row

With view=single, a phone shows one option at a time, chosen from buttons. Here the values are plain words and good, warn and bad, so no row is marked as the best.

Where to host the docs
CriterionOwn serversStatic hostWiki service
Set-up time
a week
an hour
a day
Custom domain
Good
Good
Search
Good
Who can edit
developers
developers
anyone with an account

Compare image

A before-and-after picture lays two images of the same size on top of each other, with a bar between them. Drag the bar (or anywhere on the picture), press the arrow keys, or tap the picture to flip from one to the other; the two labels jump to a whole image. Each image line gives the address and the alt text in quotes, which is what a screen reader and an LLM read. The address goes through the host's URL policy (a relative path, http or https; never data:). The two sample images are the files before-light.svg and after-dark.svg in this part's media/ folder: a host serves that folder as media/.

A dashboard, light and dark
The same dashboard on a dark pageA dashboard with four tiles and a bar chart on a light page

Diff

A diff block holds what git diff prints. It is drawn as a diff view: a file header with how much changed, line numbers on both sides, the changed words marked inside a changed line, and long unchanged runs folded. It is split on a wide part and unified on a narrow one; the buttons switch it, and view=split or view=unified fixes it. On a phone the lines do not wrap: the numbers and the sign stay in view while the code scrolls inside its box.

1 file changed+5−4

+5−4

… 11 lines
@@ -12,9 +12,10 @@ export function start(config: Config) {
1212 const port = config.port ?? 8080;
13removed: const host = "localhost";
13added: const host = config.host ?? "0.0.0.0";
1414 const server = createServer(handler);
15removed: server.listen(port, host);
15added: server.listen(port, host, () => log.info("listening", { port, host }));
1616 register(server);
1717 watch(config);
1818 return server;
… 27 lines
@@ -48,6 +49,6 @@ export function stop(server: Server) {
4849 unwatch();
49removed: server.close();
50added: server.close(() => log.info("closed"));
5051}
… 26 lines
@@ -80,18 +81,19 @@ export function reload(server: Server) {
8081 const next = readConfig();
81removed: if (next.port !== current.port) restart(server);
82added: if (next.port !== current.port || next.host !== current.host) restart(server);
8283 current = next;
8384 emit("reload", next);
8485 mark("reload");
9091 index();
9192 compact();
9293 verify();
94added: log.debug("reloaded", { port: next.port });
9395 return server;
9496}
… 11 lines
@@ -12,9 +12,10 @@ export function start(config: Config) {
12 const port = config.port ?? 8080;12 const port = config.port ?? 8080;
13 const host = "localhost";13 const host = config.host ?? "0.0.0.0";
14 const server = createServer(handler);14 const server = createServer(handler);
15 server.listen(port, host);15 server.listen(port, host, () => log.info("listening", { port, host }));
16 register(server);16 register(server);
17 watch(config);17 watch(config);
18 return server;18 return server;
… 27 lines
@@ -48,6 +49,6 @@ export function stop(server: Server) {
48 unwatch();49 unwatch();
49 server.close();50 server.close(() => log.info("closed"));
50}51}
… 26 lines
@@ -80,18 +81,19 @@ export function reload(server: Server) {
80 const next = readConfig();81 const next = readConfig();
81 if (next.port !== current.port) restart(server);82 if (next.port !== current.port || next.host !== current.host) restart(server);
82 current = next;83 current = next;
83 emit("reload", next);84 emit("reload", next);
84 mark("reload");85 mark("reload");
90 index();91 index();
91 compact();92 compact();
92 verify();93 verify();
94 log.debug("reloaded", { port: next.port });
93 return server;95 return server;
94}96}

With static the diff is drawn whole, with no button: every file open, and a folded run only says how many lines it holds.

1 file changed+1−1

src/greet.ts+1−1

@@ -1,4 +1,4 @@
11export function greet(name: string) {
2removed: return "Hello, " + name;
2added: return `Hello, ${name}!`;
33}
@@ -1,4 +1,4 @@
1export function greet(name: string) {1export function greet(name: string) {
2 return "Hello, " + name;2 return `Hello, ${name}!`;
3}3}

Downloads

A card for each file: a type icon, its size, a plain download link, and a checksum that copies on a tap, with the line that checks it. Nothing is counted and nothing is fetched until the reader presses Download.

Files for this page

  • The report, first pagesreport.pdf209 KB
    Check it with shasum -a 256 report.pdf
    Download
  • The spoken sampletalk.mp3229 KB
    Check it with shasum -a 256 talk.mp3
    Download
  • The hand-written animationbuild.json6.4 KBA Lottie file with no expressions and no images.
    Download
  • Source archive (an example address)durian-markdown-0.7.0.tar.gz1.2 MBThe address is an example; nothing is fetched until you press Download.
    Check it with shasum -a 256 durian-markdown-0.7.0.tar.gz
    Download
  • Raw datarequests.csv15.4 KBOne row per request.
    Download

Explore

A fence in the data's own language, followed by explore, becomes a foldable tree with a search box, a copy-path button on every key and a jq subset query box. It reads JSON, YAML or CSV (a CSV's rows become objects). query= is the starting query. The box runs our own small jq (the "jq subset": paths, pipes, select, map, keys, length, sort_by, group_by, to_entries, test, string interpolation, building objects and arrays); a query that needs more work than a page may use says so, and a function outside the subset is named, never answered wrongly. It lacks assignment (|=), reduce, foreach, def, paths, del, sub, gsub, match and walk.

One orderjson
2 results
  • result 1{
    • sku"tea"
    • qty2
    • price3.5
  • result 2{
    • sku"pot"
    • qty3
    • price12.25
What the query box understands (jq subset)

Has: paths and [] and slices, pipes, comma, select, map, map_values, keys, values, length, sort_by, group_by, unique_by, min_by, max_by, to_entries, from_entries, with_entries, add, has, contains, inside, any, all, flatten, test, startswith, endswith, split, join, first, last, nth, limit, range (bounded), if, try, //, as $x, string interpolation, @csv @tsv @json @text @html @uri @sh, array and object building, comparisons, and, or, not, arithmetic.

Missing: assignment (|=, =, +=), reduce, foreach, def, import, paths, path, del, walk, sub, gsub, match, capture, scan, recurse(f), until, while, repeat, env, input, destructuring, and any function not listed.

The same reader takes YAML and CSV. TOML exploration is refused until a TOML reader is available; the TOML example below is ordinary code:

A service configyaml
1 result
  • {
    • cpu"500M"
    • mem"256MI"
What the query box understands (jq subset)

Has: paths and [] and slices, pipes, comma, select, map, map_values, keys, values, length, sort_by, group_by, unique_by, min_by, max_by, to_entries, from_entries, with_entries, add, has, contains, inside, any, all, flatten, test, startswith, endswith, split, join, first, last, nth, limit, range (bounded), if, try, //, as $x, string interpolation, @csv @tsv @json @text @html @uri @sh, array and object building, comparisons, and, or, not, arithmetic.

Missing: assignment (|=, =, +=), reduce, foreach, def, import, paths, path, del, walk, sub, gsub, match, capture, scan, recurse(f), until, while, repeat, env, input, destructuring, and any function not listed.

toml
[server]
host = "198.51.100.7"
port = 8443
tls = true
[limits]
cpu = "500m"
Latency by regioncsv
1 result
  • "ap-south"
What the query box understands (jq subset)

Has: paths and [] and slices, pipes, comma, select, map, map_values, keys, values, length, sort_by, group_by, unique_by, min_by, max_by, to_entries, from_entries, with_entries, add, has, contains, inside, any, all, flatten, test, startswith, endswith, split, join, first, last, nth, limit, range (bounded), if, try, //, as $x, string interpolation, @csv @tsv @json @text @html @uri @sh, array and object building, comparisons, and, or, not, arithmetic.

Missing: assignment (|=, =, +=), reduce, foreach, def, import, paths, path, del, walk, sub, gsub, match, capture, scan, recurse(f), until, while, repeat, env, input, destructuring, and any function not listed.

Fishbone

Causes by category along a spine into the effect. In a narrow column the spine turns vertical.

Checkout takes 4seconds at p95Peopleon-call is new to theserviceProcessno load test beforea release· only staging hasreal dataToolsthe ORM loads everyline item· one query per lineEnvironmentthe database is inanother region
Checkout takes 4 seconds at p95Peopleon-call is new tothe serviceProcessno load testbefore a release· only staging hasreal dataToolsthe ORM loadsevery line item· one query perlineEnvironmentthe database is inanother region

With steps, the bones come in one at a time, and highlight lights one.

The deploy rolled backConfiga key was renamed inone place onlyTeststhe contract testwas skipped
The deploy rolled backConfiga key was renamedin one place onlyTeststhe contract testwas skipped
1The first two causes.
1 / 2

Flame chart and flame graph

A traced request and folded profiler stacks. Tap a frame to zoom; search highlights matching frames.

One request, traced

Tap a frame to zoom in.

Show the numbers as a table
FrameSelfTotalShare
db.query545445%
respond.write222218.3%
render.page181815%
auth.check121210%
handler.order88066.7%
request6120100%
CPU, 30 seconds

Tap a frame to zoom in.

Show the numbers as a table
FrameSelfTotalShare
db.query30038052.1%
parse12012016.4%
render.page959513%
lock.wait808011%
flush60608.2%
gc45456.2%
accept30304.1%
main0730100%
housekeeping0608.2%
serve067091.8%
handle059581.5%

A carousel shows one image at a time: swipe, use the arrow keys, the buttons or the dots. A tap opens the picture full screen, where pinch, wheel and double tap zoom it, and one finger or the mouse pans.

A grid crops to a ratio (the full picture stays in the lightbox), with the caption under each image.

One image, with zoom.

Gantt

A task line is <id> "label" <start> <end or length> [progress%] [done] [colour]; a start is a date or after <id> ...; milestone is a point; section groups the lines after it. today= draws a line (never the real clock). Hover, tap or focus a bar for its dates and what it waits for; Day, Week and Month change the scale.

Release 2.0
Nov 30Dec 7Dec 14Today

Hover or tap a bar for its dates.

Show the numbers as a table
TaskStartEndWaits for
Design (done)2026-12-012026-12-04
API (60%)2026-12-052026-12-12Design
Screens2026-12-052026-12-10Design
Beta2026-12-132026-12-15API, Screens
Launch (milestone)2026-12-16Beta

Under steps, progress, done and move change the plan as time passes; a slip carries the tasks after it. workdays=on makes lengths skip Saturday and Sunday, and critical=on outlines the longest chain.

A release that slips
Nov 30Dec 7Dec 14Dec 21Dec 28Today

Hover or tap a bar for its dates.

1The plan on 1 December
1 / 3
Show the numbers as a table
TaskStartEndWaits for
Design (done)2026-12-012026-12-04
API (40%)2026-12-072026-12-16Design
Screens2026-12-072026-12-14Design
QA2026-12-172026-12-23API, Screens

Glossary

Terms defined once. Where a term is used in the text, its first use in each section is a button with a dotted underline: hover it, tap it, or focus it and press Enter to read the meaning.

Words we use2
UL · also ubiquitous language
the words a team agrees on and uses in code and in talk
bounded context · also context map
one part of the system with its own words; see the book

Each team keeps its own inside a . The second use of UL in the same section stays plain text: UL.

Graph

A graph is for finding your way around a big network: what uses what, and what breaks if one part goes. Write group and node lines, then one edge a line (a -> b, with a label in quotes if it needs one). A node an edge names and no line declares is added (here the outside libraries). layout=layers puts each package above what it uses. Explore it: search a package, tap one to focus it and its neighbours (1 or 2 steps out), fold a group into one box, pan and zoom; the list beside the graph shows its links in and out. A graph this size reads as over 400 tokens, so the :::llm after it says the same in short.

A shop's packages, and what each one uses
5103312282223apps4user interface5domain9data access6core6build and test3reactchart.jszodpgioredisundicidate-fns

Turn on scripts to explore every node.

layout=force pulls linked services together and pushes the rest apart, so the clusters show. It fits calls between services, where there is no top or bottom. An id may carry a numbered range: node db-orders-{1..6} in data declares six shards, and orders -> db-orders-{1..6} draws a line to each. Fold a group (beside the graph, or a double tap on its box) and its lines join on one box with a count; Fold groups folds them all. A graph over 300 nodes, or one that would be drawn too small to touch in its box (a phone), starts with every group folded. Its LLM view is the nodes by group, the edges as a -> b lines, and the most connected nodes: here far over 400 tokens, so a :::llm says it in short.

Calls between the services of a shop
10118364214417832334322edge15identity15catalog15orders15payments15fulfilment15data stores15platform15

Turn on scripts to explore every node.

layout=radial centre=<node> puts one node in the middle and each ring one step further away, in either direction: what it uses and what uses it. Use it to answer "what touches this?". A small graph needs no :::llm: its LLM view is the graph itself, as lines.

What touches the sign-in service
442calls sign-in4sign-in calls4sign-insmskmspostgres

Turn on scripts to explore every node.

static draws the part still: the groups with how many nodes each holds, and a line that counts the edges between two groups. It is for print, a PDF, an email, or a reader who asks for less motion.

The same sign-in graph, drawn still
442calls sign-in4sign-in calls4sign-insmskmspostgres

The groups, with how many nodes each holds; a line counts the edges between two groups. 12 nodes · 12 edges

Http

An http block is a request and, after a blank line, its response, as text. It is drawn as a method tag and the address (the query split into names and values), the headers (folded after six), the body (JSON is pretty and can be folded), the status as a tag coloured by its class, and a button that copies the request as curl. A secret in a header is never written out: use a placeholder such as <token>.

Create an order
POSTapi.example.com/v1/orders?dry_run=false&currency=usdHTTP/1.1
Host
api.example.com
Content-Type
application/json
Accept
application/json
Authorization
Bearer <token>
Idempotency-Key
6f1c2d0e
User-Agent
shop-cli/2.4
{
"sku": "tea",
"qty": 2,
"ship": {
"to": "198.51.100.7",
"express": true
},
"notes": [
"gift",
"no receipt"
]
}
201CreatedHTTP/1.1
Content-Type
application/json
Location
/v1/orders/o-7
{
"id": "o-7",
"status": "open",
"total": {
"amount": 1840,
"currency": "usd"
}
}

With static the whole message is drawn: every header, the whole JSON tree, no button.

404Not FoundHTTP/1.1
Content-Type
application/json
Cache-Control
no-store
{
"error": "not_found",
"detail": {
"resource": "order",
"id": "o-9"
}
}

Log

A fence named log. It reads JSON lines, logfmt and the common "time level message key=value" shape. The filter box speaks LogQL (Grafana Loki's query language): {level="error"}, |= "timeout", != "health", |~ "5\\d\\d", | status >= 500; a box that starts with neither { nor | is plain words. Only the query half of LogQL is read, never metric queries. filter= is the starting filter. The author (often an agent) points at what matters with @highlight lines: a LogQL filter or line 3-5, a colour word and the reason in quotes.

The failed deployapp=shopenv=prod
Highlights
3 of 5 lines match {level=~"warn|error"}
  1. 32026-11-20T10:09:03Z10:09:03warn cache miss rate high rate=0.41
  2. 4–52026-11-20T10:09:05Z10:09:05error request failed path=/cart status=500 err="timeout after 30s" span=checkout trace=request×2
What the filter understands (LogQL subset)

Has: a selector {level="error", app=~"shop|cart"} over the labels and the fields of each line; line filters |= != |~ !~ ; | json and | logfmt; field filters like | status >= 500 and | duration > 2s (joined by and, or, a comma). Plain words mean |= "words".

Missing: metric queries (rate, count_over_time, sum by ...), line_format, label_format, unwrap, pattern, regexp, unpack, drop, keep.

Lottie

A Lottie file is a drawing that moves. This one was written by hand for the sample: a box fills with blocks, one row at a time, then a tick appears. It plays while it is on screen, stops off it, and shows one still frame when the reader asks for less motion. The colours: line maps names inside the file to theme colours, so it follows light and dark.

What happens while it builds

Loading

A box fills with blocks, one row at a time, then a tick appears.

Map and routes

Places and written routes work without a tile provider. A dashed route has no road geometry; the host may supply its own router.

Walk to the garden

A mouse drags · two fingers move and pinch · Ctrl + scroll zooms · arrows and + − on the keyboard

Meet at the library.

1 / 2

Country values, US states and flows share the same map and value list.

Daily flow

A mouse drags · two fingers move and pinch · Ctrl + scroll zooms · arrows and + − on the keyboard

39.550.461.472.3 – 83.2
units per dayNo data
Values · 3 regions · units per day
Flows · 1 arc · units per day

The globe uses the same data; with no WebGL it falls back to the flat map.

Global flow
Loading the globe…

A mouse drags to turn · two fingers turn and pinch · Ctrl + scroll zooms · arrows and + − on the keyboard

68.483.2
units per dayNo data
Values · 2 regions · units per day
Flows · 1 arc · units per day

A static globe is a flat map with all its values, ready to print.

A still map
68.483.2
No data
Values · 2 regions

Maths ($...$, $$...$$ and math)

The area of a circle is A=πr2A = \pi r^2, and a sum of the first nn numbers is:

∑k=1nk=n(n+1)2\sum_{k=1}^{n} k = \frac{n(n+1)}{2}

The same in a math block, with a fraction, a root and a matrix:

x=−b±b2−4ac2a(1001)x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a} \qquad \begin{pmatrix} 1 & 0 \\ 0 & 1 \end{pmatrix}

Prices stay text: it costs $5 and $10, and $not maths$ in code is left alone.

PDF

pdf.js draws the pages on a canvas, and its text layer makes the words selectable and searchable. The file below was printed from a small made-up document. The viewer works a page at a time; try the search box, the outline and the zoom.

Loading

view=scroll lays every page out in one scrolling column and draws the ones near the window.

Loading

Citations ([@key] and references)

A mark in the text opens its entry: marks make a study easier to read (), and two together are one group (; ). Hover, focus or tap a mark for the entry.

References2
  1. Lee, K. (2019). Notes on lists. Example Press. Retrieved November 20, 2026, from https://example.com/notescited once: 1
  2. Smith, J., & Lee, K. (2020). A study of marks. Journal of Studies, 12(3), 10–20. https://doi.org/10.1234/jbs.2020.4cited 2 times: 12

Sankey

A flow a line, from -> to: amount; node <id> "label" [colour] only to name or colour one. Hover, tap or focus a band to light its path and read its share.

Where a request's time goes

Hover or tap a flow or a node.

Show the numbers as a table
FromTomsShare
requestauth1213%
requesthandler8087%
handlerPostgres5569%
handlerrender2025%
handlerRedis56%

Flows under a step appear in it: the bands grow out of their source. In a narrow column, a sankey with more than three columns runs top to bottom.

Where the month's budget goes
1The money in and the big three
1 / 3

Hover or tap a flow or a node.

Show the numbers as a table
FromToUSDShare
RevenuePeople62,00062%
RevenueInfrastructure21,00021%
Revenuetools6,0006%
Revenuereserve11,00011%

Sequence

Who calls whom, in order. A call is a solid arrow, a reply a dashed one; a block (loop, alt, opt, par) frames the messages inside it. An LLM reads the messages as a numbered list.

loop until no question is leftscaffold createinit call, allanswersquestion replythe scriptstopped at aquestioninit call, onemore answerquestion replyproject written

↔ Swipe to see the whole diagram

With @step lines the story builds up one call a step: the earlier calls fade and the new one draws itself.

init call: allanswers
1The CLI sends an init call with every answer it holds.
1 / 3

Sparkline in a sentence (:spark[...])

:spark[3,5,2,8,9] draws a tiny line the height of the text. Add bar for bars and a colour word for the colour: :spark[3,5,2,8,9 bar good]. Hover, tap or focus it to see the numbers. A model reads (3, 5, 2, 8, 9).

Sign-ups this week were and rising, errors fell to , and the queue is after Wednesday's spike.

Stacktrace

A fence named stacktrace. It reads a trace as printed by Go, .NET, Bun or Node, Dart, Java or Python: the error line, each cause in its own block, threads as groups. Library frames fold into one bar; frames of your own code (app=) are marked, and with repo= and strip= they name the file and line at the page’s pinned commit (when its front matter has a matching pins entry). Tap a frame to open it.

A Go panicgo4 frames

panic: runtime error: index out of range [3] with length 3

    goroutine 18 [running]:

    Stack traces in the other five languages

    lang= may be left out when the trace says it. Each trace below is read by its own parser.

    .NET, with an inner exceptiondotnet4 frames

    System.InvalidOperationException: Cart failed

    Caused bySystem.ArgumentException: Index out of range (Parameter 'i')

    Bun or Node, with a causejs5 frames

    Error: request failed

    Caused byTypeError: bad json

    Dart, with an async gapdart4 frames

    Bad state: no element

    • ⋯ async gap
    Java, with Caused byjava4 frames

    java.lang.IllegalStateException: cart failed

    • … 12 more frames are the same as the trace above

    Caused byjava.io.IOException: boom

    • … 5 more frames are the same as the trace above
    Python, chainedpython3 frames

    ValueError: bad

    Caused byOSError: boom

    Stats

    Stat tiles are the row of big numbers at the top of a dashboard: each tile is one figure with its name, how it changed and, if given, a tiny line of its recent values, so a reader takes in the state of something at a glance before reading on. The colour word in brackets says whether the change is good or bad (a fall in latency is good); it is never guessed from the sign.

    • Requests
      1.2 M
      +12%last 7 days
    • p95 latency
      180 ms
      −8%
    • Errors
      0.4%
      +0.1of requests
    • Cost
      USD 412
      +3%

    A tile can also carry a glyph, a trend word and a sub-line. This block is static: it draws the tiles whole, the same in print.

    • Yield
      251 kg
      Across three plots
      ↗ Trend: up
      +8%this season
    • Water
      120 L
      Stored rainwater
      ↘ Trend: down
      −6%this week
    • Beds
      30
      Ready for planting
      → Trend: flat

    Timeline

    One line per event, oldest first; an indented line is a detail. A year, a month or a day.

    1. Design review
      • Scope and owners agreed
    2. First release
    3. Old drawing code removed
      • New drawn parts take their place
    4. Version 2 shipsthe big one

    With dir=across a wide screen lays it out sideways; a phone is always top to bottom. With steps, the events come in one group at a time.

    1. The idea
    2. A prototype
    3. A first user
    1The first half of the year.
    1 / 2

    Trace waterfall

    A request across services. Fold spans, search, zoom the mini map, or switch to Flame.

    POST /checkout
    webPOST /checkout842 msgatewayroute /checkout835 msauthverify.token38 msPostgresSELECT sessions28 mscartcart.load158 msPostgresSELECT cart_items69 msPostgresSELECT prices72 msinventorystock.reserve121 msPostgresUPDATE stock109 mspaymentcharge.card604 mspaymenttls.connect43 mspaymentprovider.call546 msqueuepublish.retry20 ms

    Hover, tap or focus a span for its card.

    Show the numbers as a table
    TraceLengthselfError
    web POST /checkout842 ms7 ms
    · gateway route /checkout835 ms15 ms
    · · auth verify.token38 ms10 ms
    · · · Postgres SELECT sessions28 ms28 ms
    · · cart cart.load158 ms17 ms
    · · · Postgres SELECT cart_items69 ms69 ms
    · · · Postgres SELECT prices72 ms72 ms
    · · inventory stock.reserve121 ms12 ms
    · · · Postgres UPDATE stock109 ms109 ms
    · · payment charge.card604 ms15 mspayment provider timed out
    · · · payment tls.connect43 ms43 ms
    · · · payment provider.call546 ms546 msupstream timeout after 540 ms
    · · queue publish.retry20 ms20 ms
    GET /health
    webGET /health9 ms

    Hover, tap or focus a span for its card.

    Show the numbers as a table
    TraceLengthselfError
    web GET /health9 ms2 ms
    · api health.check7 ms3 ms
    · · db SELECT 14 ms4 ms
    A flat list
    webGET /orders60 msapiorders.list52 msdbSELECT orders32 msapiorders.render13 ms

    Hover, tap or focus a span for its card.

    Show the numbers as a table
    TraceLengthselfError
    web GET /orders60 ms8 ms
    · api orders.list52 ms7 ms
    · · db SELECT orders32 ms32 ms
    · · api orders.render13 ms13 ms

    Venn

    Two to four sets in fixed, even shapes. It is not drawn to scale on purpose: the names are written in the regions. Hover, tap or focus a region to read its items; on a narrow screen they are listed under the figure.

    GoRustZig
    • Go only: Ana, Ben
    • Rust only: Eve, Fay
    • Zig only: 4 people
    • Go and Rust only: Cy
    • all three: Dee (writes all three)

    With steps, one set comes in at a time, with its regions.

    ReadersWritersReviewers
    • Readers only: Ana, Ben
    • Writers only: Dee
    • Readers and Writers only: Cy
    1Readers and writers overlap.
    1 / 2

    Video

    A video part keeps the browser's video and draws its own controls: a big play button on the poster, a bar with the chapters as segments (point at it to see the chapter and a still), captions drawn by us from a WebVTT file, picture in picture and full screen. The picture here is a made-up moving gradient.

    0:00 / 0:12

    clip is for a short screen recording that would otherwise be a GIF: it plays muted and in a loop while it is on screen, stops when it scrolls away, and stays still when the reader asks for less motion.

    Wardley map

    Components by evolution (left to right) and visibility (top to bottom). Positions are named keys, so the two numbers cannot be swapped.

    genesiscustom builtproductcommodityevolution →visible ↑CustomerCup of teaTeaKettlePowerKettles are a productnow

    ↔ Swipe to see the whole diagram

    1Today the kettle is a product we buy.
    1 / 2

    Weather

    A forecast written in the source; it never fetches. The units menu on the part switches °C and °F, km/h, mph, m/s and knots, mm and inches, hPa and inHg, and your choice is remembered in this browser.

    San Francisco
    1. Sun 22sunny18°11°0%–12 km/h1021 hPa
    2. Mon 23partly cloudy16°10°10%–15 km/h1018 hPa
    3. Tue 24rain14°9°80%6 mm30 km/h1004 hPa
    4. Wed 25storm13°8°95%14 mm45 km/h996 hPaFerry may stop
    5. Thu 26cloudy12°7°30%1 mm20 km/h1009 hPa

    Written in the source; nothing is fetched. Switch the units above; your choice is remembered in this browser.

    Hours work the same way, with one temperature, here written in °F and mph.

    Oakland
    1. 06:00
    2. 09:00
    3. 12:00
    4. 15:00
    5. 18:00
    6. 21:00
    1. 5%4 mph
    2. 20%8 mph
    3. 60%11 mph
    4. 85%14 mph
    5. 70%12 mph
    6. 25%7 mph

    Written in the source; nothing is fetched. Switch the units above; your choice is remembered in this browser.

    The same forecast with static: drawn whole in the fence's unit, with no menu.

    Sydney
    1. Sun 22sunny24°17°0%14 km/h
    2. Mon 23partly cloudy22°16°20%18 km/h
    3. Tue 24sleet3°-1°70%22 km/hIce on the road

    Written in the source; nothing is fetched.

    Source: `fixtures/parts/samples.dh.md`
    text
    ---
    title: The folder parts
    ---
    <!-- generated by scripts/parts.ts from the folders under src/parts/: do not edit -->
    # The folder parts
    Every part that lives in its own folder, with its sample. The Format page shows each as source, drawing and LLM view.
    ## Audio
    An audio part is a player of our own. The wave is drawn from a small peaks file and moves with the sound; chapters split it, a marker flags one moment, and the transcript follows the voice.
    ```audio src="media/talk.mp3" title="A page that talks" duration=0:57 wave=bars skip=10 transcript=open
    peaks: media/talk.peaks.json
    chapter 0:00 Welcome
    chapter 0:24 The transcript
    chapter 0:38 The marker
    marker 0:38 Where the example crashed [bad]
    0:00 Ana: Welcome back. Today we look at a page that can talk.
    0:04 Ben: A page that talks. Do you mean the audio part?
    0:08 Ana: Yes. You write one fence, with a file, a title, and a few lines of transcript.
    0:14 Ben: And the reader sees a wave that moves while the voice plays.
    0:18 Ana: The wave is drawn from a small peaks file, so it appears before the sound starts.
    0:24 Ben: What about people who cannot listen right now?
    0:27 Ana: The transcript follows the voice. Tap a line, and the player jumps there.
    0:33 Ben: Chapters split the wave into parts, and a marker flags one moment.
    0:38 Ana: Here is the marker. This is where the example crashed.
    0:42 Ben: And a language model reads the same page as plain text.
    0:46 Ana: It gets the title, the chapters, and the transcript, never a picture of a wave.
    0:52 Ben: That is the whole part. Press play, and listen again.
    ```
    `wave=mirror` reflects the wave, `wave=dots` draws it in dots, `wave=live` shows a window of the sound that scrolls past "now", and `compact` makes one row. The colour is a word (`tone=c4`), never a hex value.
    ```audio src="media/talk.mp3" title="Mirror wave, in family colour 4" wave=mirror tone=c4 height=s duration=0:57
    peaks: media/talk.peaks.json
    ```
    ```audio src="media/talk.mp3" title="Compact" compact wave=line duration=0:57
    peaks: media/talk.peaks.json
    ```
    ## Calendar
    The host supplies no clock here: Today returns to the authored date. Explore the views, switch calendars and open events. A narrow part starts with three days.
    ```calendar title="Release week" tz=Europe/London date=2026-11-23 view=week hours=08-18
    calendar team "Team" [c2]
    2026-11-23 09:00-09:20 Stand-up in team every weekday times=5
    2026-11-24 10:00-11:30 Design review @ Studio in team note="Bring the mock-ups"
    2026-11-24 10:30-11:00 Review notes in team
    2026-11-25 all day Code freeze [warn]
    2026-11-26 18:00-19:00 Sydney call tz=Australia/Sydney
    ```
    The static form keeps a complete dated list without controls.
    ```calendar title="Release checklist" tz=Europe/London date=2026-11-23 static
    calendar team "Team" [c2]
    2026-11-23 09:00-09:20 Stand-up in team every weekday times=3
    2026-11-25 all day Code freeze [warn]
    ```
    ## Chart kinds
    Eight more kinds of a `chart`, each a YAML map with `kind:` at the top: raw values are counted, quartiled or smoothed when the page is built, so a model reads the table. Hover, tap or focus a bin, box, stage, block or day for its card; the arrow keys walk the data.
    ```chart
    kind: histogram
    title: How long a request takes
    x: { label: latency, format: duration-ms }
    y: { label: requests }
    bins: 12
    marks: [p50, p95]
    data: [74, 88, 109, 110, 86, 88, 122, 87, 132, 140, 93, 50, 99, 127, 56, 69, 80, 114, 67, 66, 89, 95, 125, 102, 120, 73, 91, 107, 42, 78, 75, 99, 155, 115, 25, 54, 113, 82, 84, 85, 94, 121, 168, 191]
    ```
    ```chart
    kind: boxplot
    title: Checkout time by day
    x: { label: day, values: [Mon, Tue, Wed] }
    y: { label: seconds to pay, format: duration }
    tone: c4
    data:
    - [120, 100, 121, 110, 106, 125, 169, 146, 134, 102, 132, 128, 114, 152]
    - [173, 121, 152, 144, 132, 143, 153, 117, 130, 134, 146, 176, 149, 166]
    - [118, 116, 162, 140, 161, 166, 136, 170, 158, 138, 126, 160, 154, 260]
    ```
    ```chart
    kind: violin
    title: Response time by service
    x: { label: service, values: [api, search, checkout] }
    y: { label: response, format: duration-ms }
    tone: c2
    data:
    - [57, 69, 117, 111, 105, 83, 98, 105, 124, 101, 88, 102, 117, 83, 99, 101, 101, 99]
    - [141, 198, 207, 164, 144, 149, 163, 206, 121, 232, 154, 227, 237, 119, 174, 148, 195, 192]
    - [243, 242, 239, 262, 246, 212, 247, 222, 252, 201, 213, 203, 204, 248, 234, 261, 258, 213]
    ```
    ```chart
    kind: funnel
    title: From visit to paid
    tone: c1
    data:
    - [Visited the site, 48200]
    - [Created an account, 8700]
    - [Started a trial, 4100]
    - [Paid, 1350]
    steps:
    - title: Last quarter.
    - title: After the shorter sign-up form.
    data:
    - [Visited the site, 49500]
    - [Created an account, 11300]
    - [Started a trial, 5200]
    - [Paid, 1720]
    ```
    ```chart
    kind: waterfall
    title: Monthly revenue bridge
    x: { label: driver, values: [October, New, Churn, Refunds, Subtotal, Price rise, November] }
    y: { label: revenue, format: money, currency: EUR }
    data: [84000, 12500, -9100, -2300, "=", 4800, "="]
    ```
    ```chart
    kind: treemap
    title: Where the disk went
    y: { label: disk use, format: bytes }
    data:
    - name: Media
    children:
    - { name: Videos, value: 412000000000 }
    - { name: Photos, value: 186000000000 }
    - name: Code
    children:
    - { name: Repos, value: 86000000000 }
    - { name: Build cache, value: 88000000000 }
    - { name: Backups, value: 140000000000 }
    ```
    ```chart
    kind: sunburst
    title: Lines of code by team and area (thousands)
    y: { label: lines of code }
    data:
    - name: Platform
    children:
    - { name: Runtime, value: 93 }
    - { name: Storage, value: 66 }
    - name: Product
    children:
    - { name: Web, value: 95 }
    - { name: Mobile, value: 69 }
    - { name: Docs, value: 18 }
    ```
    ```chart
    kind: calendar
    title: Commits, September to November
    y: { label: commits }
    tone: good
    from: 2026-09-01
    to: 2026-11-30
    data: [["2026-09-01", 7], ["2026-09-02", 6], ["2026-09-03", 5], ["2026-09-07", 4], ["2026-09-09", 2], ["2026-09-12", 2], ["2026-09-14", 4], ["2026-09-15", 10], ["2026-09-16", 1], ["2026-09-17", 3], ["2026-09-18", 5], ["2026-09-21", 8], ["2026-09-23", 9], ["2026-09-24", 5], ["2026-09-25", 3], ["2026-09-26", 2], ["2026-09-27", 1], ["2026-09-28", 9], ["2026-09-29", 8], ["2026-09-30", 7], ["2026-10-01", 8], ["2026-10-02", 9], ["2026-10-04", 1], ["2026-10-05", 5], ["2026-10-06", 9], ["2026-10-11", 2], ["2026-10-12", 9], ["2026-10-13", 9], ["2026-10-15", 5], ["2026-10-16", 6], ["2026-10-17", 1], ["2026-10-18", 1], ["2026-10-20", 8], ["2026-10-21", 3], ["2026-10-22", 6], ["2026-10-23", 6], ["2026-10-24", 1], ["2026-10-25", 1], ["2026-10-26", 2], ["2026-10-29", 7], ["2026-10-30", 7], ["2026-10-31", 1], ["2026-11-01", 0], ["2026-11-04", 4], ["2026-11-06", 5], ["2026-11-07", 0], ["2026-11-08", 0], ["2026-11-09", 2], ["2026-11-11", 2], ["2026-11-12", 6], ["2026-11-13", 8], ["2026-11-14", 2], ["2026-11-15", 0], ["2026-11-16", 8], ["2026-11-17", 6], ["2026-11-18", 3], ["2026-11-19", 1], ["2026-11-21", 2], ["2026-11-22", 2], ["2026-11-23", 3], ["2026-11-24", 8], ["2026-11-26", 7], ["2026-11-27", 10], ["2026-11-28", 0], ["2026-11-29", 1], ["2026-11-30", 7]]
    ```
    Each kind takes `title`, `tone` where it makes sense, `y: { label, format, currency }` for the value axis (the histogram's is `x`), and `steps:` that change `data`, `marks` or `bins` from one step to the next.
    ## Compare
    **A comparison matrix puts options side by side, one line for each thing you judge them on.** The first line names the options; every other line is a criterion and one value for each option, in the same order. A note in round brackets shows when a reader hovers, focuses or taps the value. With `winner=on` the best value of each yes/no, scored or good/bad row is marked; `pick=` flags the option you recommend.
    ```compare title="Which queue?" winner=on pick=Kafka
    options: Redis Streams [c1], Kafka [c2], SQS [c3]
    Ordering: yes, yes, partial (FIFO queues only)
    Runs itself: no, no, yes
    Throughput: 3, 5, 3 (score 1-5)
    Latency (lower is better): 4 ms (in one region), 12 ms, 25 ms
    Replay old messages: yes (until trimmed), yes (by offset), no
    Cost at our size: good, bad, good (pay per request)
    Team knows it: yes, partial (two people), yes
    ```
    With `view=single`, a phone shows one option at a time, chosen from buttons. Here the values are plain words and good, warn and bad, so no row is marked as the best.
    ```compare title="Where to host the docs" view=single
    options: Own servers, Static host, Wiki service
    Set-up time: a week, an hour, a day
    Custom domain: good, good, warn (paid plan only)
    Search: warn (add one), warn (add one), good
    Who can edit: developers, developers, anyone with an account
    ```
    ## Compare image
    **A before-and-after picture lays two images of the same size on top of each other, with a bar between them.** Drag the bar (or anywhere on the picture), press the arrow keys, or tap the picture to flip from one to the other; the two labels jump to a whole image. Each image line gives the address and the alt text in quotes, which is what a screen reader and an LLM read. The address goes through the host's URL policy (a relative path, http or https; never `data:`). The two sample images are the files `before-light.svg` and `after-dark.svg` in this part's `media/` folder: a host serves that folder as `media/`.
    ```compare-image title="A dashboard, light and dark" before="Light" after="Dark"
    before: media/before-light.svg "A dashboard with four tiles and a bar chart on a light page"
    after: media/after-dark.svg "The same dashboard on a dark page"
    ```
    ## Diff
    A `diff` block holds what `git diff` prints. It is drawn as a diff view: a file header with how much changed, line numbers on both sides, the changed words marked inside a changed line, and long unchanged runs folded. It is split on a wide part and unified on a narrow one; the buttons switch it, and `view=split` or `view=unified` fixes it. On a phone the lines do not wrap: the numbers and the sign stay in view while the code scrolls inside its box.
    ```diff
    diff --git a/src/server.ts b/src/server.ts
    index 4b825dc..9f3c1a7 100644
    --- a/src/server.ts
    +++ b/src/server.ts
    @@ -12,9 +12,10 @@ export function start(config: Config) {
    const port = config.port ?? 8080;
    - const host = "localhost";
    + const host = config.host ?? "0.0.0.0";
    const server = createServer(handler);
    - server.listen(port, host);
    + server.listen(port, host, () => log.info("listening", { port, host }));
    register(server);
    watch(config);
    return server;
    @@ -48,6 +49,6 @@ export function stop(server: Server) {
    unwatch();
    - server.close();
    + server.close(() => log.info("closed"));
    }
    @@ -80,18 +81,19 @@ export function reload(server: Server) {
    const next = readConfig();
    - if (next.port !== current.port) restart(server);
    + if (next.port !== current.port || next.host !== current.host) restart(server);
    current = next;
    emit("reload", next);
    mark("reload");
    audit(next);
    notify(next);
    flush();
    settle();
    prune();
    index();
    compact();
    verify();
    + log.debug("reloaded", { port: next.port });
    return server;
    }
    ```
    With `static` the diff is drawn whole, with no button: every file open, and a folded run only says how many lines it holds.
    ```diff static
    --- a/src/greet.ts
    +++ b/src/greet.ts
    @@ -1,4 +1,4 @@
    export function greet(name: string) {
    - return "Hello, " + name;
    + return `Hello, ${name}!`;
    }
    ```
    ## Downloads
    A card for each file: a type icon, its size, a plain download link, and a checksum that copies on a tap, with the line that checks it. Nothing is counted and nothing is fetched until the reader presses Download.
    ```downloads title="Files for this page"
    media/report.pdf "The report, first pages" 209 KB sha256=d14bdfa9e9a37c960e8a2835fd6c0e75aa6e201e1e967d18159378e3de124372
    media/talk.mp3 "The spoken sample" 229 KB sha256=8ed40d5dc963c74c457b987f9af4b4f3a33f1c13aa7a547cd3e959bf6fcd5d55
    media/build.json "The hand-written animation" 6.4 KB note="A Lottie file with no expressions and no images."
    https://example.com/durian-markdown-0.7.0.tar.gz "Source archive (an example address)" 1.2 MB sha256=2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae note="The address is an example; nothing is fetched until you press Download."
    media/requests.csv "Raw data" 15.4 KB note="One row per request."
    ```
    ## Explore
    A fence in the data's own language, followed by `explore`, becomes a foldable tree with a search box, a copy-path button on every key and a **jq subset** query box. It reads JSON, YAML or CSV (a CSV's rows become objects). `query=` is the starting query. The box runs our own small jq (the "jq subset": paths, pipes, `select`, `map`, `keys`, `length`, `sort_by`, `group_by`, `to_entries`, `test`, string interpolation, building objects and arrays); a query that needs more work than a page may use says so, and a function outside the subset is named, never answered wrongly. It lacks assignment (`|=`), `reduce`, `foreach`, `def`, `paths`, `del`, `sub`, `gsub`, `match` and `walk`.
    ```json explore title="One order" query=".lines[] | select(.qty > 1)"
    {
    "id": "o-7",
    "customer": { "id": "c-12", "name": "Ana", "tags": ["vip", "early"] },
    "lines": [
    { "sku": "tea", "qty": 2, "price": 3.5 },
    { "sku": "cup", "qty": 1, "price": 8 },
    { "sku": "pot", "qty": 3, "price": 12.25 }
    ],
    "paid": true,
    "note": null
    }
    ```
    The same reader takes YAML and CSV. TOML exploration is refused until a TOML reader is available; the TOML example below is ordinary code:
    ```yaml explore title="A service config" query=".limits | map_values(ascii_upcase)"
    service: shop
    replicas: 3
    limits:
    cpu: 500m
    mem: 256Mi
    hosts:
    - name: app-1.example.com
    zone: a
    - name: app-2.example.com
    zone: b
    ```
    ```toml
    [server]
    host = "198.51.100.7"
    port = 8443
    tls = true
    [limits]
    cpu = "500m"
    ```
    ```csv explore title="Latency by region" query="sort_by(.p95) | reverse | .[0].region"
    region,p50,p95,requests
    us-west,42,120,1200000
    eu-central,55,180,830000
    ap-south,70,260,410000
    ```
    ## Fishbone
    Causes by category along a spine into the effect. In a narrow column the spine turns vertical.
    ```fishbone title="Why is checkout slow?"
    effect: Checkout takes 4 seconds at p95
    People: on-call is new to the service
    Process: no load test before a release
    only staging has real data
    Tools: the ORM loads every line item
    one query per line
    Environment: the database is in another region
    ```
    With steps, the bones come in one at a time, and `highlight` lights one.
    ```fishbone title="Why did the deploy fail?"
    effect: The deploy rolled back
    @step The first two causes.
    Config: a key was renamed in one place only
    Tests: the contract test was skipped
    @step The third, and the one to fix first.
    Release: two services shipped in the wrong order
    highlight Config
    ```
    ## Flame chart and flame graph
    A traced request and folded profiler stacks. Tap a frame to zoom; search highlights matching frames.
    ```flame title="One request, traced" unit=ms
    0 120 request
    2 14 auth.check
    15 95 handler.order
    16 70 db.query
    72 90 render.page
    96 118 respond.write
    ```
    ```flame title="CPU, 30 seconds" unit=samples colour=heat
    main;serve;handle;parse 120
    main;serve;handle;db.query 300
    main;serve;handle;db.query;lock.wait 80
    main;serve;handle;render.page 95
    main;serve;gc 45
    main;serve;accept 30
    main;housekeeping;flush 60
    ```
    ## Gallery
    A carousel shows one image at a time: swipe, use the arrow keys, the buttons or the dots. A tap opens the picture full screen, where pinch, wheel and double tap zoom it, and one finger or the mouse pans.
    ```gallery title="Four sample pictures" view=carousel loop
    ![A harbour at dawn: a low sun over a still sea](media/harbour.svg "Harbour at dawn: a made-up picture for the sample")
    ![A pine forest in green light](media/forest.svg "Pine forest")
    ![Sand dunes under a pale sky](media/dunes.svg "Dunes at noon")
    ![A mountain behind a lake](media/lake.svg "Mountain lake")
    ```
    A grid crops to a ratio (the full picture stays in the lightbox), with the caption under each image.
    ```gallery title="The same pictures, as a grid" view=grid columns=3 ratio=4:3
    ![A harbour at dawn](media/harbour.svg "Harbour")
    ![A pine forest](media/forest.svg "Forest")
    ![Sand dunes](media/dunes.svg "Dunes")
    ![A mountain lake](media/lake.svg "Lake")
    ```
    One image, with zoom.
    ```gallery view=single
    ![A mountain behind a lake](media/lake.svg "Tap the picture to see it full screen")
    ```
    ## Gantt
    A task line is `<id> "label" <start> <end or length> [progress%] [done] [colour]`; a start is a date or `after <id> ...`; `milestone` is a point; `section` groups the lines after it. `today=` draws a line (never the real clock). Hover, tap or focus a bar for its dates and what it waits for; Day, Week and Month change the scale.
    ```gantt title="Release 2.0" today=2026-12-09
    section Build
    design "Design" 2026-12-01 .. 2026-12-04 done
    api "API" after design 8d 60%
    ui "Screens" after design 6d
    section Ship
    beta "Beta" after api ui 3d [warn]
    launch "Launch" milestone after beta
    ```
    Under steps, `progress`, `done` and `move` change the plan as time passes; a slip carries the tasks after it. `workdays=on` makes lengths skip Saturday and Sunday, and `critical=on` outlines the longest chain.
    ```gantt title="A release that slips" workdays=on critical=on today=2026-12-14
    section Build
    design "Design" 2026-12-01 .. 2026-12-04 done
    api "API" after design 8d 40%
    ui "Screens" after design 6d
    section Test
    qa "QA" after api ui 5d
    @step The plan on 1 December
    @step Design is done, the API is under way
    progress api 60%
    progress ui 100%
    @step The API slips by a week
    move api 2026-12-14
    launch "Launch" milestone after qa
    ```
    ## Glossary
    Terms defined once. Where a term is used in the text, its first use in each section is a button with a dotted underline: hover it, tap it, or focus it and press Enter to read the meaning.
    ```glossary title="Words we use"
    term "UL" also "ubiquitous language": the words a team agrees on and uses in code and in talk
    term bc "bounded context" also "context map": one part of the system with its own **words**; see [the book](https://example.com/ddd)
    ```
    Each team keeps its own UL inside a bounded context. The second use of UL in the same section stays plain text: UL.
    ## Graph
    A graph is for finding your way around a big network: what uses what, and what breaks if one part goes. Write `group` and `node` lines, then one edge a line (`a -> b`, with a label in quotes if it needs one). A node an edge names and no line declares is added (here the outside libraries). `layout=layers` puts each package above what it uses. **Explore it:** search a package, tap one to focus it and its neighbours (1 or 2 steps out), fold a group into one box, pan and zoom; the list beside the graph shows its links in and out. A graph this size reads as over 400 tokens, so the `:::llm` after it says the same in short.
    ```graph title="A shop's packages, and what each one uses" layout=layers
    group apps "apps" [c1]
    group ui "user interface" [c4]
    group domain "domain" [c2]
    group data "data access" [c6]
    group core "core" [c3]
    group tools "build and test" [muted]
    node web "web shop" in apps
    node admin "admin console" in apps
    node worker "background worker" in apps
    node cli "command line" in apps
    node ui-kit, charts, forms, icons, theme in ui
    node cart, checkout, catalog, accounts, search, pricing, orders, money, auth in domain
    node db, cache, queue, events, http-client, storage in data
    node config, log, errors, util, i18n, time in core
    node build, lint, test-kit in tools
    web -> ui-kit, forms, cart, checkout, catalog, search, accounts, i18n
    admin -> ui-kit, charts, forms, orders, catalog, accounts
    worker -> orders, events, queue, log
    cli -> config, catalog, db
    ui-kit -> theme, icons, react
    charts -> ui-kit, chart.js "lazy"
    forms -> ui-kit, zod
    cart -> pricing, catalog, cache
    checkout -> cart, orders, money, auth
    catalog -> db, search, storage
    accounts -> auth, db, events
    search -> http-client, cache
    pricing -> money, catalog
    orders -> db, money, events, queue
    money -> util
    auth -> db, cache, errors
    db -> pg, config, log, errors
    cache -> ioredis, config
    queue -> ioredis, events
    events -> log, time
    http-client -> undici, errors
    storage -> http-client, config
    config -> zod, util
    log -> time, util
    errors -> util
    i18n -> date-fns, util
    time -> date-fns
    test-kit -> db, cache, config "fakes"
    build, lint -> config
    ```
    :::llm
    A layered package graph of a shop: 33 packages in 6 groups, plus 7 outside libraries (react, chart.js, zod, pg, ioredis, undici, date-fns); 80 edges. The apps (web shop, admin console, background worker, command line) use the user interface packages (ui-kit, charts, forms, icons, theme) and the domain packages (cart, checkout, catalog, accounts, search, pricing, orders, money, auth). The domain uses data access (db, cache, queue, events, http-client, storage), which uses core (config, log, errors, util, i18n, time). Checkout needs cart, orders, money and auth; auth needs db, cache and errors. Most connected: db (6 in, 4 out), config (7 in, 2 out), web (8 out), catalog (5 in, 3 out).
    :::
    `layout=force` pulls linked services together and pushes the rest apart, so the clusters show. It fits calls between services, where there is no top or bottom. An id may carry a numbered range: `node db-orders-{1..6} in data` declares six shards, and `orders -> db-orders-{1..6}` draws a line to each. **Fold a group** (beside the graph, or a double tap on its box) and its lines join on one box with a count; **Fold groups** folds them all. A graph over 300 nodes, or one that would be drawn too small to touch in its box (a phone), starts with every group folded. Its LLM view is the nodes by group, the edges as `a -> b` lines, and the most connected nodes: here far over 400 tokens, so a `:::llm` says it in short.
    ```graph title="Calls between the services of a shop" layout=force size=l
    group edge "edge" [c1]
    group identity "identity" [c2]
    group catalog "catalog" [c3]
    group orders "orders" [c4]
    group payments "payments" [c5]
    group fulfil "fulfilment" [c6]
    group data "data stores" [c8]
    group platform "platform" [c7]
    node cdn, waf, gateway, web-bff, mobile-bff, admin-bff, graphql, rate-limit, bot-check, geo-route, edge-cache, ws-hub, upload-proxy, img-proxy, status-page in edge
    node auth, sessions, users, profiles, roles, mfa, sso, tokens, consent, audit, password-reset, email-verify, devices, risk-score, api-keys in identity
    node catalog-api, products, variants, inventory, prices, promos, reviews, search-api, indexer, recs, media, categories, brands, bundles, wishlist in catalog
    node cart-api, checkout, orders-api, order-events, invoices, returns, refunds, tax, shipping-quote, gift-cards, loyalty, quotes, subscriptions, order-history, fraud in orders
    node pay-api, card-vault, psp-a, psp-b, wallets, payouts, ledger, fx, disputes, settlements, pay-events, three-ds, chargebacks, billing, receipts in payments
    node fulfil-api, warehouses, picking, packing, carriers, labels, tracking, dispatch, slots, couriers, stock-sync, returns-in, notify, sms, email in fulfil
    node db-orders-{1..6}, db-users, db-catalog, cache-{1..3}, search-index, blob-store, event-bus, dw in data
    node config-svc, flags, secrets, metrics, logs, traces, scheduler, jobs, alerts, ci, registry, mesh, dns, kms, backups in platform
    cdn -> edge-cache, img-proxy, waf
    waf -> gateway, bot-check, rate-limit
    gateway -> web-bff, mobile-bff, admin-bff, graphql, ws-hub, upload-proxy, geo-route
    web-bff -> auth, sessions, catalog-api, cart-api, search-api, recs, checkout
    mobile-bff -> auth, sessions, catalog-api, cart-api, search-api, wishlist, checkout
    admin-bff -> auth, roles, catalog-api, orders-api, refunds, users, audit
    graphql -> catalog-api, orders-api, profiles, reviews
    ws-hub -> tracking, order-events, sessions
    upload-proxy -> media, blob-store
    img-proxy -> media
    status-page -> metrics, alerts
    auth -> sessions, users, mfa, sso, tokens, risk-score, devices
    sessions -> cache-1, tokens
    users -> db-users, profiles, email-verify, audit
    profiles -> db-users, media, consent
    roles -> db-users, audit
    mfa -> sms, email, devices
    sso -> tokens, users
    tokens -> kms, cache-1
    password-reset -> email, tokens, users
    email-verify -> email
    api-keys -> tokens, db-users
    risk-score -> devices, fraud
    catalog-api -> products, categories, brands, prices, inventory, media, bundles
    products -> variants, db-catalog, cache-2
    variants -> db-catalog
    inventory -> db-catalog, stock-sync, event-bus
    prices -> promos, fx, cache-2
    promos -> db-catalog
    reviews -> db-catalog, users
    search-api -> search-index, recs
    indexer -> search-index, event-bus, products
    recs -> dw, cache-2
    wishlist -> db-users, products
    cart-api -> products, prices, promos, cache-3, gift-cards
    checkout -> cart-api, tax, shipping-quote, pay-api, orders-api, fraud, loyalty
    orders-api -> db-orders-{1..6}, order-events, invoices
    order-events -> event-bus
    invoices -> tax, receipts, blob-store
    returns -> orders-api, returns-in, refunds
    refunds -> pay-api, ledger
    tax -> fx
    shipping-quote -> carriers, slots
    gift-cards -> ledger
    loyalty -> users, ledger
    quotes -> prices, tax
    subscriptions -> billing, orders-api, scheduler
    order-history -> db-orders-{1..6}, dw
    fraud -> risk-score, dw
    pay-api -> card-vault, psp-a, psp-b, wallets, three-ds, ledger, pay-events
    card-vault -> kms, secrets
    psp-a, psp-b -> pay-events
    wallets -> ledger
    payouts -> ledger, psp-a, settlements
    ledger -> fx, dw
    disputes -> chargebacks, psp-a, psp-b
    settlements -> ledger, dw
    pay-events -> event-bus
    chargebacks -> ledger
    billing -> pay-api, receipts
    receipts -> email, blob-store
    fulfil-api -> warehouses, dispatch, labels, tracking
    warehouses -> stock-sync, picking
    picking -> packing
    packing -> labels
    labels -> carriers, blob-store
    carriers -> tracking
    tracking -> notify, event-bus
    dispatch -> couriers, slots, carriers
    stock-sync -> inventory, event-bus
    returns-in -> warehouses, refunds
    notify -> sms, email
    event-bus -> fulfil-api, indexer, notify, dw, audit
    scheduler -> jobs
    jobs -> backups, indexer, payouts, settlements
    alerts -> metrics, logs
    mesh -> dns, traces, metrics
    backups -> blob-store
    ci -> registry
    config-svc -> flags, secrets
    secrets -> kms
    gateway, auth, checkout, pay-api, orders-api -> mesh
    ```
    :::llm
    A force-laid call graph of a shop: 120 services in 8 groups, 232 calls. Edge (cdn, waf, gateway, three backends for web, mobile and admin, graphql, ws-hub ...) calls identity (auth, sessions, users, tokens, mfa, sso ...) and catalog (catalog-api, products, prices, search-api, recs ...). Checkout calls cart-api, tax, shipping-quote, fraud, loyalty, pay-api and orders-api; orders-api writes six shards, db-orders-1 to db-orders-6. pay-api calls card-vault, two payment providers, wallets, three-ds and the ledger. Events go through event-bus to fulfilment (warehouses, picking, packing, labels, carriers, tracking), the indexer, notify, the warehouse (dw) and audit. Platform: config, flags, secrets, kms, metrics, logs, traces, the mesh, scheduler and jobs. Most connected: orders-api (5 in, 9 out), auth, catalog-api, pay-api, event-bus (6 in, 5 out).
    :::
    `layout=radial centre=<node>` puts one node in the middle and each ring one step further away, in either direction: what it uses and what uses it. Use it to answer "what touches this?". A small graph needs no `:::llm`: its LLM view is the graph itself, as lines.
    ```graph title="What touches the sign-in service" layout=radial centre=auth
    group callers "calls sign-in" [c1]
    group needs "sign-in calls" [c6]
    node web, mobile, admin, cli in callers
    node sessions, users, mfa, tokens in needs
    node auth "sign-in"
    web, mobile, admin, cli -> auth
    auth -> sessions, users, mfa, tokens
    mfa -> sms "codes"
    tokens -> kms "signing keys"
    sessions, users -> postgres
    ```
    `static` draws the part still: the groups with how many nodes each holds, and a line that counts the edges between two groups. It is for print, a PDF, an email, or a reader who asks for less motion.
    ```graph title="The same sign-in graph, drawn still" layout=radial centre=auth static
    group callers "calls sign-in" [c1]
    group needs "sign-in calls" [c6]
    node web, mobile, admin, cli in callers
    node sessions, users, mfa, tokens in needs
    node auth "sign-in"
    web, mobile, admin, cli -> auth
    auth -> sessions, users, mfa, tokens
    mfa -> sms "codes"
    tokens -> kms "signing keys"
    sessions, users -> postgres
    ```
    ## Http
    An `http` block is a request and, after a blank line, its response, as text. It is drawn as a method tag and the address (the query split into names and values), the headers (folded after six), the body (JSON is pretty and can be folded), the status as a tag coloured by its class, and a button that copies the request as `curl`. A secret in a header is never written out: use a placeholder such as `<token>`.
    ```http title="Create an order"
    POST /v1/orders?dry_run=false&currency=usd HTTP/1.1
    Host: api.example.com
    Content-Type: application/json
    Accept: application/json
    Authorization: Bearer <token>
    Idempotency-Key: 6f1c2d0e
    User-Agent: shop-cli/2.4
    X-Request-Id: req-7a91
    { "sku": "tea", "qty": 2, "ship": { "to": "198.51.100.7", "express": true }, "notes": ["gift", "no receipt"] }
    HTTP/1.1 201 Created
    Content-Type: application/json
    Location: /v1/orders/o-7
    { "id": "o-7", "status": "open", "total": { "amount": 1840, "currency": "usd" } }
    ```
    With `static` the whole message is drawn: every header, the whole JSON tree, no button.
    ```http static
    HTTP/1.1 404 Not Found
    Content-Type: application/json
    Cache-Control: no-store
    { "error": "not_found", "detail": { "resource": "order", "id": "o-9" } }
    ```
    ## Log
    A fence named `log`. It reads JSON lines, logfmt and the common "time level message key=value" shape. The filter box speaks **LogQL** (Grafana Loki's query language): `{level="error"}`, `|= "timeout"`, `!= "health"`, `|~ "5\\d\\d"`, `| status >= 500`; a box that starts with neither `{` nor `|` is plain words. Only the query half of LogQL is read, never metric queries. `filter=` is the starting filter. The author (often an agent) points at what matters with `@highlight` lines: a LogQL filter or `line 3-5`, a colour word and the reason in quotes.
    ```log title="The failed deploy" labels="app=shop, env=prod" filter="{level=~\"warn|error\"}"
    2026-11-20T10:08:01Z info deploy started version=1.4
    2026-11-20T10:08:12Z info migration applied name=0042
    2026-11-20T10:09:03Z warn cache miss rate high rate=0.41
    2026-11-20T10:09:05Z error request failed path=/cart status=500 err="timeout after 30s" span=checkout trace=request
    2026-11-20T10:09:06Z error request failed path=/cart status=500 err="timeout after 30s" span=checkout trace=request
    @highlight |= "timeout" [bad] "every failure is the same timeout"
    @highlight line 3 [warn] "the first sign"
    ```
    ## Lottie
    A Lottie file is a drawing that moves. This one was written by hand for the sample: a box fills with blocks, one row at a time, then a tick appears. It plays while it is on screen, stops off it, and shows one still frame when the reader asks for less motion. The `colours:` line maps names inside the file to theme colours, so it follows light and dark.
    ```lottie src="media/build.json" title="What happens while it builds" loop
    alt: A box fills with blocks, one row at a time, then a tick appears.
    colours: dh-c1 = c1, dh-c2 = c2, dh-c3 = c3, dh-good = good
    ```
    ## Map and routes
    Places and written routes work without a tile provider. A dashed route has no road geometry; the host may supply its own router.
    ```map title="Walk to the garden"
    place start "Library" 51.507, -0.128 [c1] note="Meet by the entrance"
    place garden "Garden" 51.511, -0.117 [c2]
    route walk "Morning walk" by=walk [c2]: start -> 51.508, -0.123 -> garden
    @step Meet at the library.
    focus start
    @step Follow the written route.
    show walk
    focus walk
    ```
    Country values, US states and flows share the same map and value list.
    ```map title="Daily flow" unit="units per day" scale=steps steps=4
    fill DE 83.2
    fill FR 68.4
    fill US-CA 39.5
    arc DE -> FR 24 "Daily flow" [c2]
    ```
    The globe uses the same data; with no WebGL it falls back to the flat map.
    ```map title="Global flow" view=globe spin=off unit="units per day"
    fill DE 83.2
    fill FR 68.4
    arc DE -> FR 24 "Daily flow" [c2]
    ```
    A static globe is a flat map with all its values, ready to print.
    ```map title="A still map" view=globe static
    fill DE 83.2
    fill FR 68.4
    ```
    ## Maths (`$...$`, `$$...$$` and `math`)
    The area of a circle is $A = \pi r^2$, and a sum of the first $n$ numbers is:
    $$
    \sum_{k=1}^{n} k = \frac{n(n+1)}{2}
    $$
    The same in a `math` block, with a fraction, a root and a matrix:
    ```math
    x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a} \qquad
    \begin{pmatrix} 1 & 0 \\ 0 & 1 \end{pmatrix}
    ```
    Prices stay text: it costs $5 and $10, and `$not maths$` in code is left alone.
    ## PDF
    pdf.js draws the pages on a canvas, and its text layer makes the words selectable and searchable. The file below was printed from a small made-up document. The viewer works a page at a time; try the search box, the outline and the zoom.
    ```pdf src="media/sample.pdf" title="A sample document" page=1 height=l
    ```
    `view=scroll` lays every page out in one scrolling column and draws the ones near the window.
    ```pdf src="media/sample.pdf" title="The same file, scrolling" view=scroll height=s
    ```
    ## Citations (`[@key]` and `references`)
    A mark in the text opens its entry: marks make a study easier to read [@smith2020, p. 12], and two together are one group [@smith2020; @lee2019]. Hover, focus or tap a mark for the entry.
    ```references style=apa title="References"
    - id: smith2020
    author: Smith, Jane; Lee, Kim
    title: A study of marks
    in: Journal of Studies
    year: 2020
    volume: 12
    issue: 3
    pages: 10-20
    doi: 10.1234/jbs.2020.4
    - id: lee2019
    author: Lee, Kim
    title: Notes on lists
    type: web
    publisher: Example Press
    year: 2019
    url: https://example.com/notes
    accessed: 2026-11-20
    ```
    ## Sankey
    A flow a line, `from -> to: amount`; `node <id> "label" [colour]` only to name or colour one. Hover, tap or focus a band to light its path and read its share.
    ```sankey title="Where a request's time goes" unit=ms
    request -> auth: 12
    request -> handler: 80
    handler -> db: 55
    handler -> render: 20
    handler -> cache: 5
    node db "Postgres" [c3]
    node cache "Redis" [c2]
    ```
    Flows under a step appear in it: the bands grow out of their source. In a narrow column, a sankey with more than three columns runs top to bottom.
    ```sankey title="Where the month's budget goes" unit=USD
    income -> payroll: 62000
    income -> infra: 21000
    income -> tools: 6000
    income -> reserve: 11000
    @step The money in and the big three
    @step Infrastructure breaks down
    infra -> compute: 12500
    infra -> storage: 5200
    infra -> network: 3300
    @step Compute splits by team
    compute -> web: 7000
    compute -> data: 4100
    compute -> ml: 1400
    node income "Revenue" [c1]
    node payroll "People" [c4]
    node infra "Infrastructure" [c6]
    ```
    ## Sequence
    Who calls whom, in order. A call is a solid arrow, a reply a dashed one; a block (`loop`, `alt`, `opt`, `par`) frames the messages inside it. An LLM reads the messages as a numbered list.
    ```sequence title="One init call"
    actor dev "developer"
    participant cli "CLI"
    participant tc "template container"
    dev -> cli: scaffold create
    cli -> tc: init call, all answers
    tc --> cli: question reply
    note tc: the script stopped at a question
    loop until no question is left
    cli -> tc: init call, one more answer
    tc --> cli: question reply
    end
    cli --> dev: project written
    ```
    With `@step` lines the story builds up one call a step: the earlier calls fade and the new one draws itself.
    ```sequence
    participant cli "CLI"
    participant tc "template container"
    @step The CLI sends an init call with every answer it holds.
    cli -> tc: init call: all answers
    @step The script stops at a question and sends it back.
    tc --> cli: question reply
    @step The next init call carries one answer more.
    cli -> tc: init call: one more answer
    ```
    ## Sparkline in a sentence (`:spark[...]`)
    `:spark[3,5,2,8,9]` draws a tiny line the height of the text. Add `bar` for bars and a colour word for the colour: `:spark[3,5,2,8,9 bar good]`. Hover, tap or focus it to see the numbers. A model reads `(3, 5, 2, 8, 9)`.
    Sign-ups this week were :spark[120,135,128,160,182,171,205] and rising, errors fell to :spark[14,12,15,9,7,4,3 bar good], and the queue is :spark[5,4,6,22,31,18,9 warn] after Wednesday's spike.
    ## Stacktrace
    A fence named `stacktrace`. It reads a trace as printed by Go, .NET, Bun or Node, Dart, Java or Python: the error line, each cause in its own block, threads as groups. Library frames fold into one bar; frames of your own code (`app=`) are marked, and with `repo=` and `strip=` they name the file and line at the page’s pinned commit (when its front matter has a matching pins entry). Tap a frame to open it.
    ```stacktrace lang=go app=example.com/shop repo=example.com/shop strip=/src/shop/ title="A Go panic"
    panic: runtime error: index out of range [3] with length 3
    goroutine 18 [running]:
    example.com/shop/cart.(*Cart).Item(...)
    /src/shop/cart/cart.go:42
    example.com/shop/api.(*Server).getItem(0xc0001a2000, {0x7f1c, 0xc000124000}, 0xc000188000)
    /src/shop/api/items.go:88 +0x1d4
    net/http.HandlerFunc.ServeHTTP(0xc000010040, {0x7f1c, 0xc000124000}, 0xc000188000)
    /usr/local/go/src/net/http/server.go:2136 +0x29
    net/http.serverHandler.ServeHTTP({0xc00011e000}, {0x7f1c, 0xc000124000}, 0xc000188000)
    /usr/local/go/src/net/http/server.go:2938 +0x8e
    ```
    ## Stack traces in the other five languages
    `lang=` may be left out when the trace says it. Each trace below is read by its own parser.
    ```stacktrace app=Acme.Shop title=".NET, with an inner exception"
    System.InvalidOperationException: Cart failed
    ---> System.ArgumentException: Index out of range (Parameter 'i')
    at Acme.Shop.Cart.Item(Int32 i) in /src/shop/Cart.cs:line 42
    at System.Linq.Enumerable.First[TSource](IEnumerable`1 source)
    --- End of inner exception stack trace ---
    at Acme.Shop.Api.GetItem(Int32 id) in /src/shop/Api.cs:line 88
    at Microsoft.AspNetCore.Mvc.Invoke()
    ```
    ```stacktrace app=/src/shop title="Bun or Node, with a cause"
    Error: request failed
    at fetchItem (file:///src/shop/api.ts:42:11)
    at async handler (/src/shop/server.ts:10:3)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at run (/src/shop/node_modules/lib/index.js:5:9)
    Caused by: TypeError: bad json
    at parse (/src/shop/util.ts:7:2)
    ```
    ```stacktrace app=shop title="Dart, with an async gap"
    Unhandled exception:
    Bad state: no element
    #0 Cart.item (package:shop/cart.dart:42:7)
    #1 Api.get (package:shop/api.dart:10:3)
    <asynchronous suspension>
    #2 _rootRunUnary (dart:async/zone.dart:1407:47)
    #3 State.setState (package:flutter/src/widgets/framework.dart:1100:9)
    ```
    ```stacktrace app=com.acme.shop title="Java, with Caused by"
    java.lang.IllegalStateException: cart failed
    at com.acme.shop.Cart.item(Cart.java:42)
    at com.acme.shop.Api.get(Api.java:88)
    at java.base/java.util.ArrayList.get(ArrayList.java:427)
    ... 12 more
    Caused by: java.io.IOException: boom
    at com.acme.shop.Db.read(Db.java:7)
    ... 5 common frames omitted
    ```
    ```stacktrace app=/src/app title="Python, chained"
    Traceback (most recent call last):
    File "/src/app/db.py", line 5, in read
    raise OSError("boom")
    OSError: boom
    The above exception was the direct cause of the following exception:
    Traceback (most recent call last):
    File "/src/app/main.py", line 10, in <module>
    run()
    File "/usr/lib/python3.11/site-packages/x.py", line 5, in run
    raise ValueError("bad")
    ValueError: bad
    ```
    ## Stats
    **Stat tiles are the row of big numbers at the top of a dashboard:** each tile is one figure with its name, how it changed and, if given, a tiny line of its recent values, so a reader takes in the state of something at a glance before reading on. The colour word in brackets says whether the change is good or bad (a fall in latency is good); it is never guessed from the sign.
    ```stats title="The week"
    Requests "1.2 M" change=+12% [good] note="last 7 days" spark=3 5 4 6 8 9
    p95 latency "180 ms" change=-8% [good] spark=9 8 8 7 7 6 5
    Errors "0.4%" change=+0.1 [bad] note="of requests" spark=2 2 3 2 4 5
    Cost "USD 412" change=+3% spark=4 4 5 5 5 6
    ```
    A tile can also carry a glyph, a trend word and a sub-line. This block is `static`: it draws the tiles whole, the same in print.
    ```stats title="Garden at a glance" static
    Yield "251 kg" glyph="✦" trend=up sub="Across three plots" change=+8% [good] note="this season" spark=180 192 205 224 251
    Water "120 L" glyph="◉" trend=down sub="Stored rainwater" change=-6% [good] note="this week" spark=150 145 138 126 120
    Beds "30" glyph="▦" trend=flat sub="Ready for planting" [c3]
    ```
    ## Timeline
    One line per event, oldest first; an indented line is a detail. A year, a month or a day.
    ```timeline title="A release plan"
    2026-05-04 Design review [c1]
    Scope and owners agreed
    2026-09 First release [c2]
    2026-11-21 Old drawing code removed [c5]
    New drawn parts take their place
    2026-11-23 Version 2 ships [good] note="the big one"
    ```
    With `dir=across` a wide screen lays it out sideways; a phone is always top to bottom. With steps, the events come in one group at a time.
    ```timeline title="A build-up" dir=across
    2026 The idea
    @step The first half of the year.
    2026-03 A prototype
    2026-06 A first user
    @step The second half.
    2026-09 First release [c2]
    2026-12 Version 2 [good]
    ```
    ## Trace waterfall
    A request across services. Fold spans, search, zoom the mini map, or switch to Flame.
    ```trace title="POST /checkout" unit=ms trace=t-7f3a
    web POST /checkout 0 842 user=u7 region=us-west-2
    gateway route /checkout 3 838 route=checkout
    auth verify.token 6 44 method=jwt
    db SELECT sessions 10 38 rows=1
    cart cart.load 47 205 items=3
    db SELECT cart_items 52 121 rows=3
    db SELECT prices 126 198 rows=3 cache=miss
    inventory stock.reserve 50 171 warehouse=w2
    db UPDATE stock 57 166 rows=1 id=stock-update
    payment charge.card 208 812 provider=examplepay error="payment provider timed out"
    payment tls.connect 212 255
    payment provider.call 258 804 attempt=1 id=provider error="upstream timeout after 540 ms"
    queue publish.retry 814 834 topic=payments.retry id=retry
    @log db 130 warn "row lock held 94 ms" span=stock-update
    @log payment 258 info "calling examplepay /v2/charge"
    @log payment 804 error "upstream timeout after 540 ms, giving up"
    @log queue 820 info "queued a retry for order o-2291"
    @log web 840 error "answered 504 to the client"
    @service db [c5] "Postgres"
    ```
    :::llm
    One checkout request, 842 ms, across 8 services. The payment provider call (258–804 ms) timed out, so charge.card and the request failed with a 504, and a retry was queued. Stock was reserved in parallel with the cart load and is not on the critical path; UPDATE stock in db waited 94 ms on a row lock.
    :::
    ```trace title="GET /health" unit=ms open=2
    web GET /health 0 9
    api health.check 1 8
    db SELECT 1 2 6
    ```
    ```trace title="A flat list" unit=ms critical=off
    web GET /orders 0 60 id=a
    api orders.list 3 55 id=b parent=a
    db SELECT orders 8 40 id=c parent=b rows=25
    api orders.render 41 54 id=d parent=b
    ```
    ## Venn
    Two to four sets in fixed, even shapes. It is not drawn to scale on purpose: the names are written in the regions. Hover, tap or focus a region to read its items; on a narrow screen they are listed under the figure.
    ```venn title="Who writes what"
    set go "Go" [c1]
    set rust "Rust" [c2]
    set zig "Zig" [c3]
    go: Ana, Ben
    go & rust: Cy
    go & rust & zig: Dee (writes all three)
    rust: Eve, Fay
    zig: 4 people
    ```
    With steps, one set comes in at a time, with its regions.
    ```venn title="Adding one set at a time"
    set a "Readers" [c4]
    set b "Writers" [c5]
    set c "Reviewers" [c6]
    @step Readers and writers overlap.
    a: Ana, Ben
    a & b: Cy
    b: Dee
    @step Reviewers join; some people do all three.
    c: Eve
    a & b & c: Fay
    ```
    ## Video
    A video part keeps the browser's video and draws its own controls: a big play button on the poster, a bar with the chapters as segments (point at it to see the chapter and a still), captions drawn by us from a WebVTT file, picture in picture and full screen. The picture here is a made-up moving gradient.
    ```video src="media/sample.mp4" poster="media/poster.jpg" title="Colours drifting" duration=0:12
    captions: media/sample.en.vtt "English" default
    thumbs: media/thumbs.vtt
    chapter 0:00 Warm
    chapter 0:04 Cool
    chapter 0:08 Bright
    0:00 The colours drift slowly across the frame.
    0:04 Captions are drawn by the part from a WebVTT file.
    0:08 Press C to turn them off, and F for full screen.
    ```
    `clip` is for a short screen recording that would otherwise be a GIF: it plays muted and in a loop while it is on screen, stops when it scrolls away, and stays still when the reader asks for less motion.
    ```video src="media/clip.mp4" title="A short silent loop" clip height=s
    ```
    ## Wardley map
    Components by evolution (left to right) and visibility (top to bottom). Positions are named keys, so the two numbers cannot be swapped.
    ```wardley title="A tea shop"
    anchor customer "Customer" visible=0.95 evolution=0.6
    component cup "Cup of tea" visible=0.8 evolution=0.6
    component tea "Tea" visible=0.6 evolution=0.8
    component kettle "Kettle" visible=0.45 evolution=0.4
    component power "Power" visible=0.1 evolution=0.85
    customer -> cup
    cup -> tea
    cup -> kettle
    kettle -> power
    note "Kettles are a product now" visible=0.3 evolution=0.1
    @step Today the kettle is a product we buy.
    highlight kettle
    @step A smart kettle moves it further to the right.
    evolve kettle 0.65 "smart kettle"
    ```
    ## Weather
    A forecast written in the source; it never fetches. The units menu on the part switches °C and °F, km/h, mph, m/s and knots, mm and inches, hPa and inHg, and your choice is remembered in this browser.
    ```weather place="San Francisco" unit=c tz=America/Los_Angeles
    2026-11-22 sun 18/11 rain=0% wind=12km/h pressure=1021hPa
    2026-11-23 partly 16/10 rain=10% wind=15km/h pressure=1018hPa
    2026-11-24 rain 14/9 rain=80% wind=30km/h precip=6mm pressure=1004hPa
    2026-11-25 storm 13/8 rain=95% wind=45km/h precip=14mm pressure=996hPa note="Ferry may stop"
    2026-11-26 cloud 12/7 rain=30% wind=20km/h precip=1mm pressure=1009hPa
    ```
    Hours work the same way, with one temperature, here written in °F and mph.
    ```weather place="Oakland" unit=f wind=mph tz=America/Los_Angeles
    2026-11-24 06:00 fog 48 rain=5% wind=4mph
    2026-11-24 09:00 cloud 52 rain=20% wind=8mph
    2026-11-24 12:00 drizzle 57 rain=60% wind=11mph
    2026-11-24 15:00 rain 59 rain=85% wind=14mph
    2026-11-24 18:00 rain 55 rain=70% wind=12mph
    2026-11-24 21:00 cloud 51 rain=25% wind=7mph
    ```
    The same forecast with `static`: drawn whole in the fence's unit, with no menu.
    ```weather static place="Sydney" unit=c wind=kmh
    2026-11-22 sun 24/17 rain=0% wind=14km/h
    2026-11-23 partly 22/16 rain=20% wind=18km/h
    2026-11-24 sleet 3/-1 rain=70% wind=22km/h note="Ice on the road"
    ```