Story Format
Minimal example
Section titled “Minimal example”meta: title: "Request Flow" d2_source: my-diagram.d2
steps: - id: step-01 tag: "01" title: "Client sends request" body: | The client initiates an HTTP POST to /api/data. Authentication is handled at this boundary. nodes: - Client - Server
- id: step-02 tag: "02" title: "Server queries database" nodes: - Server - DatabaseTop-level fields
Section titled “Top-level fields”title: human-readable title of the storyd2_source: path to the corresponding D2 diagram
Ordered list of narrative beats.
Each step can include:
id: stable identifiertag: short label shown in the viewer navigationtitle: step headingbody: optional narration bodynodes: array of node IDs to highlight for this step
Linking to D2 nodes
Section titled “Linking to D2 nodes”Node IDs are case-sensitive and must match the D2 source exactly.
Optional annotations
Section titled “Optional annotations”diascope init can scaffold a story file from D2 comments such as:
# @step step-01Client -> Server: POST /api/dataDetail panels
Section titled “Detail panels”Use detail_panels to attach HTML content to a node.
detail_panels: Server: | <p>Handles authentication and request routing.</p>Edge tooltips
Section titled “Edge tooltips”Use edge_tooltips to attach extra context to an edge label.
edge_tooltips: "POST /api/data": "Authenticated with Bearer token"LLM editing rules
Section titled “LLM editing rules”- Add steps by appending a new unique
id - Never invent node IDs that are not present in the D2 file
- Preserve existing
idvalues if the D2 file uses# @stepmarkers - Run
diascope buildafter edits to validate the updated story