@diagrammo/dgmo 0.8.2 → 0.8.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (120) hide show
  1. package/.claude/commands/dgmo-diagram-this.md +60 -0
  2. package/.claude/commands/dgmo-document-project.md +128 -0
  3. package/.claude/commands/dgmo.md +185 -50
  4. package/.cursorrules +32 -37
  5. package/.github/copilot-instructions.md +35 -44
  6. package/.windsurfrules +32 -37
  7. package/README.md +4 -4
  8. package/dist/cli.cjs +189 -194
  9. package/dist/editor.cjs +336 -0
  10. package/dist/editor.cjs.map +1 -0
  11. package/dist/editor.d.cts +27 -0
  12. package/dist/editor.d.ts +27 -0
  13. package/dist/editor.js +305 -0
  14. package/dist/editor.js.map +1 -0
  15. package/dist/index.cjs +3699 -1564
  16. package/dist/index.cjs.map +1 -1
  17. package/dist/index.d.cts +7 -6
  18. package/dist/index.d.ts +7 -6
  19. package/dist/index.js +3699 -1564
  20. package/dist/index.js.map +1 -1
  21. package/docs/language-reference.md +822 -1060
  22. package/gallery/fixtures/arc.dgmo +18 -0
  23. package/gallery/fixtures/area.dgmo +19 -0
  24. package/gallery/fixtures/bar-stacked.dgmo +10 -0
  25. package/gallery/fixtures/bar.dgmo +10 -0
  26. package/gallery/fixtures/c4-full.dgmo +52 -0
  27. package/gallery/fixtures/c4.dgmo +17 -0
  28. package/gallery/fixtures/chord.dgmo +12 -0
  29. package/gallery/fixtures/class-basic.dgmo +14 -0
  30. package/gallery/fixtures/class-full.dgmo +43 -0
  31. package/gallery/fixtures/doughnut.dgmo +8 -0
  32. package/gallery/fixtures/flowchart-basic.dgmo +3 -0
  33. package/gallery/fixtures/flowchart-colors.dgmo +5 -0
  34. package/gallery/fixtures/flowchart-complex.dgmo +17 -0
  35. package/gallery/fixtures/flowchart-decision.dgmo +5 -0
  36. package/gallery/fixtures/flowchart-full.dgmo +13 -0
  37. package/gallery/fixtures/flowchart-groups.dgmo +10 -0
  38. package/gallery/fixtures/flowchart-loop.dgmo +7 -0
  39. package/gallery/fixtures/flowchart-nested.dgmo +7 -0
  40. package/gallery/fixtures/flowchart-shapes.dgmo +5 -0
  41. package/gallery/fixtures/function.dgmo +8 -0
  42. package/gallery/fixtures/funnel.dgmo +7 -0
  43. package/gallery/fixtures/gantt-full.dgmo +49 -0
  44. package/gallery/fixtures/gantt.dgmo +42 -0
  45. package/gallery/fixtures/heatmap.dgmo +8 -0
  46. package/gallery/fixtures/infra-full.dgmo +78 -0
  47. package/gallery/fixtures/infra-overload.dgmo +25 -0
  48. package/gallery/fixtures/infra.dgmo +47 -0
  49. package/gallery/fixtures/initiative-status-full.dgmo +46 -0
  50. package/gallery/fixtures/initiative-status-phases.dgmo +29 -0
  51. package/gallery/fixtures/initiative-status.dgmo +9 -0
  52. package/gallery/fixtures/line.dgmo +19 -0
  53. package/gallery/fixtures/multi-line.dgmo +11 -0
  54. package/gallery/fixtures/org-basic.dgmo +16 -0
  55. package/gallery/fixtures/org-full.dgmo +69 -0
  56. package/gallery/fixtures/org-teams.dgmo +25 -0
  57. package/gallery/fixtures/pie.dgmo +9 -0
  58. package/gallery/fixtures/polar-area.dgmo +8 -0
  59. package/gallery/fixtures/quadrant.dgmo +18 -0
  60. package/gallery/fixtures/radar.dgmo +8 -0
  61. package/gallery/fixtures/sankey.dgmo +31 -0
  62. package/gallery/fixtures/scatter.dgmo +21 -0
  63. package/gallery/fixtures/sequence-tags-protocols.dgmo +45 -0
  64. package/gallery/fixtures/sequence-tags.dgmo +41 -0
  65. package/gallery/fixtures/sequence.dgmo +35 -0
  66. package/gallery/fixtures/sitemap-basic.dgmo +12 -0
  67. package/gallery/fixtures/sitemap-full.dgmo +156 -0
  68. package/gallery/fixtures/slope.dgmo +8 -0
  69. package/gallery/fixtures/spr-eras.dgmo +62 -0
  70. package/gallery/fixtures/state.dgmo +30 -0
  71. package/gallery/fixtures/timeline-intraday.dgmo +14 -0
  72. package/gallery/fixtures/timeline.dgmo +32 -0
  73. package/gallery/fixtures/venn.dgmo +10 -0
  74. package/gallery/fixtures/wordcloud.dgmo +24 -0
  75. package/package.json +51 -2
  76. package/src/c4/layout.ts +372 -90
  77. package/src/c4/parser.ts +113 -62
  78. package/src/chart.ts +149 -64
  79. package/src/class/parser.ts +84 -28
  80. package/src/class/renderer.ts +2 -2
  81. package/src/cli.ts +179 -77
  82. package/src/completion.ts +381 -182
  83. package/src/d3.ts +1026 -428
  84. package/src/dgmo-mermaid.ts +16 -13
  85. package/src/dgmo-router.ts +70 -24
  86. package/src/echarts.ts +682 -169
  87. package/src/editor/dgmo.grammar +69 -0
  88. package/src/editor/dgmo.grammar.d.ts +2 -0
  89. package/src/editor/dgmo.grammar.js +18 -0
  90. package/src/editor/dgmo.grammar.terms.d.ts +5 -0
  91. package/src/editor/dgmo.grammar.terms.js +35 -0
  92. package/src/editor/highlight.ts +36 -0
  93. package/src/editor/index.ts +28 -0
  94. package/src/editor/keywords.ts +220 -0
  95. package/src/editor/tokens.ts +30 -0
  96. package/src/er/parser.ts +55 -29
  97. package/src/er/renderer.ts +112 -53
  98. package/src/gantt/calculator.ts +91 -29
  99. package/src/gantt/parser.ts +291 -97
  100. package/src/gantt/renderer.ts +1120 -350
  101. package/src/graph/flowchart-parser.ts +48 -75
  102. package/src/graph/state-parser.ts +54 -27
  103. package/src/infra/parser.ts +161 -177
  104. package/src/infra/renderer.ts +723 -271
  105. package/src/infra/types.ts +0 -1
  106. package/src/initiative-status/parser.ts +144 -56
  107. package/src/kanban/parser.ts +27 -19
  108. package/src/org/layout.ts +111 -44
  109. package/src/org/parser.ts +71 -27
  110. package/src/org/resolver.ts +3 -3
  111. package/src/palettes/index.ts +3 -2
  112. package/src/render.ts +1 -2
  113. package/src/sequence/parser.ts +209 -100
  114. package/src/sitemap/parser.ts +73 -44
  115. package/src/utils/arrows.ts +2 -22
  116. package/src/utils/duration.ts +39 -21
  117. package/src/utils/legend-constants.ts +0 -2
  118. package/src/utils/parsing.ts +82 -72
  119. package/src/utils/tag-groups.ts +4 -41
  120. package/src/infra/serialize.ts +0 -67
@@ -28,1494 +28,1256 @@ Syntax changes introduced in the consistency cleanup. Old forms now produce erro
28
28
  | `show-sub-node-count: yes` | `show-sub-node-count` (flag) | Org |
29
29
  | `import: path` | `import path` | Org |
30
30
  | `tags: path` | `tags path` | Org |
31
+ | `xlabel` | `x-label` | Data charts, function |
32
+ | `ylabel` | `y-label` | Data charts, function |
33
+ | `sizelabel` | `size-label` | Scatter/bubble |
34
+ | `x-axis` | `x-label` | Quadrant |
35
+ | `y-axis` | `y-label` | Quadrant |
31
36
 
32
37
  ---
33
38
 
34
- ## Common Patterns
39
+ ## Table of Contents
40
+
41
+ 1. [Universal Constructs](#1-universal-constructs)
42
+ 2. [Sequence Diagrams](#2-sequence-diagrams)
43
+ 3. [Infrastructure Diagrams](#3-infrastructure-diagrams)
44
+ 4. [Flowchart Diagrams](#4-flowchart-diagrams)
45
+ 5. [State Diagrams](#5-state-diagrams)
46
+ 6. [Org Charts](#6-org-charts)
47
+ 7. [C4 Architecture Diagrams](#7-c4-architecture-diagrams)
48
+ 8. [Entity-Relationship Diagrams](#8-entity-relationship-diagrams)
49
+ 9. [Class Diagrams](#9-class-diagrams)
50
+ 10. [Kanban Boards](#10-kanban-boards)
51
+ 11. [Initiative-Status Diagrams](#11-initiative-status-diagrams)
52
+ 12. [Sitemap Diagrams](#12-sitemap-diagrams)
53
+ 13. [Gantt Charts](#13-gantt-charts)
54
+ 14. [Timeline Diagrams](#14-timeline-diagrams)
55
+ 15. [Data Charts](#15-data-charts)
56
+ 16. [Visualizations](#16-visualizations)
57
+ 17. [Colon Usage Summary](#17-colon-usage-summary)
35
58
 
36
- Every `.dgmo` file starts with a chart type keyword as the first line, optionally followed by a title. Directives follow on subsequent lines.
59
+ ---
37
60
 
38
- ### First Line
61
+ ## 1. Universal Constructs
39
62
 
40
- ```
41
- bar Revenue by Region
42
- ```
63
+ These patterns are shared across all or most diagram types.
43
64
 
44
- The chart type keyword (`bar`, `sequence`, `gantt`, etc.) is the first token. Everything after it on the same line becomes the title. If the content is unambiguous, the chart type is auto-detected and can be omitted.
45
-
46
- ### Directives
65
+ ### 1.1 Chart Type Declaration (First Line)
47
66
 
48
67
  ```
49
- palette nord
50
- theme dark
51
- xlabel Category
52
- ylabel Count
68
+ <chart-type> [Title]
53
69
  ```
54
70
 
55
- Directives are `keyword value` (no colon). They appear after the first line, before data.
71
+ - Space-separated, NO colon
72
+ - Title is optional
73
+ - Examples: `bar Treasure Hauls`, `sequence Auth Flow`, `gantt Product Launch`
56
74
 
57
- ### Comments
75
+ ### 1.2 Comments
58
76
 
59
77
  ```
60
- // This is a comment (only // is supported)
78
+ // comment text
61
79
  ```
62
80
 
63
- ### Inline Colors
81
+ - Full-line only (no inline comments after code)
82
+ - `#` is NOT a comment character
64
83
 
65
- Append `(colorname)` to labels, nodes, or data points:
84
+ ### 1.3 Tag Declarations
66
85
 
67
86
  ```
68
- Port Royal(red) 850
69
- [Process(blue)]
87
+ tag GroupName [alias X]
88
+ Value1(color)
89
+ Value2(color) [default]
70
90
  ```
71
91
 
72
- Named colors only: `red`, `orange`, `yellow`, `green`, `blue`, `purple`, `teal`, `cyan`, `gray`. Palette-specific colors also available. Hex color codes (e.g. `#ff0000`) are **not** supported — use named colors instead.
92
+ - `tag` keyword, NO colon
93
+ - Alias: 1-4 lowercase letters
94
+ - Inline values also supported: `tag Priority p Low(green), High(red)`
95
+ - First entry is default unless another is marked `default`
96
+ - Must appear before diagram content
73
97
 
74
- ### Palettes and Themes
98
+ **Diagram types that support tags**: sequence, infra, org, c4, er, kanban, gantt, initiative-status, sitemap, timeline
75
99
 
76
- 8 palettes: `nord` (default), `solarized`, `catppuccin`, `rose-pine`, `gruvbox`, `tokyo-night`, `one-dark`, `bold`
100
+ ### 1.4 Pipe Metadata
77
101
 
78
- 3 themes per palette: `light`, `dark`, `transparent`
102
+ ```
103
+ EntityName | key: value, key2: value2
104
+ ```
79
105
 
80
- Set via CLI: `dgmo diagram.dgmo --palette catppuccin --theme dark`
106
+ - Colons ARE required within pipe segments (`key: value`)
107
+ - Items separated by commas
108
+ - Tag aliases resolve: `| c: Caching` resolves to `concern: Caching` (if `tag Concern alias c` is defined)
109
+ - One pipe per line only
81
110
 
82
- ### Inline Markdown
111
+ ### 1.5 Color Suffixes
83
112
 
84
- Text fields support: `*italic*`, `**bold**`, `` `code` ``, `[link text](url)`. Bare URLs are auto-linked.
113
+ ```
114
+ Label(colorName)
115
+ ```
85
116
 
86
- ### Multi-line Values
117
+ - Named palette colors only (no hex codes)
118
+ - Appears at end of labels, node names, tag values, series names
119
+ - Color is stripped from display text
87
120
 
88
- Properties that accept comma-separated lists (`series`, `columns`, `rows`, `x-axis`, `y-axis`) also accept an indented multi-line format. Leave the value empty and list each value on its own indented line:
121
+ ### 1.6 Indentation
89
122
 
90
- ```
91
- // Single-line (still works)
92
- series Rum, Spices, Silk, Gold
123
+ - Spaces or tabs (1 tab = 4 spaces)
124
+ - Determines hierarchy and block scope
93
125
 
94
- // Multi-line equivalent
95
- series
96
- Rum
97
- Spices
98
- Silk
99
- Gold
100
- ```
101
-
102
- Multi-line blocks support blank lines and `//` comments within the block. Trailing commas on values are stripped for convenience.
126
+ ### 1.7 Groups / Containers
103
127
 
104
128
  ```
105
- series
106
- Rum (red)
107
- Spices (green)
108
- // gold last
109
- Gold (yellow)
129
+ [Group Name]
130
+ [Group Name](color)
131
+ [Group Name] | key: value
110
132
  ```
111
133
 
112
- Works with `columns` and `rows` in heatmaps:
134
+ - Bracket-enclosed name
135
+ - Optional color suffix
136
+ - Optional pipe metadata (outside brackets)
137
+ - Indented content below belongs to the group
138
+
139
+ ### 1.8 Boolean Options
113
140
 
114
141
  ```
115
- columns
116
- January
117
- February
118
- March
142
+ option-name // on
143
+ no-option-name // off
119
144
  ```
120
145
 
146
+ - Bare keyword = on; `no-` prefix = off
147
+ - Must appear before diagram content
148
+
121
149
  ---
122
150
 
123
- ## Chart Types
151
+ ## 2. Sequence Diagrams
124
152
 
125
- ### bar
153
+ ### 2.1 Participants
126
154
 
127
- **Syntax:** `bar [Title]`
155
+ ```
156
+ Name is a <type> [aka Alias] [position N]
157
+ Name | key: value
158
+ ```
128
159
 
129
- **Options:** `series`, `xlabel`, `ylabel`, `orientation` (`horizontal`/`vertical`), `labels` (`name`/`value`/`percent`/`full`), `color`
160
+ Types: `service`, `database`, `actor`, `queue`, `cache`, `gateway`, `external`, `networking`, `frontend`
130
161
 
131
- **Data format:** `Label value` one row per category
162
+ **Inference rules** — the parser infers the type (and shape) from the participant name. Only use `is a` when the name does not match or you want to override:
132
163
 
133
- **Example:**
164
+ | Inferred Type | Shape | Name Patterns (examples) |
165
+ |--------------|-------|--------------------------|
166
+ | actor | Stick figure | `User`, `Customer`, `Client`, `Admin`, `Agent`, `Person`, `Buyer`, `Seller`, `Guest`, `Visitor`, `Operator`, Alice, Bob, Charlie, `*User`, `*Actor`, `*Analyst`, `*Staff` |
167
+ | service | Rounded rectangle | `*Service`, `*Svc`, `*API`, Lambda, `*Function`, `*Fn`, `*Job`, Cron, Auth, SSO, OAuth, Stripe, Twilio, S3, Vercel, Docker, K8s, Vault, KMS, IAM, LLM, GPT, Claude, `*Pipeline`, `*Engine`, and many `-er`/`-or` suffixes (Scheduler, Handler, Processor, Worker, etc.) |
168
+ | database | Cylinder (vertical) | `*DB`, `Database`, `*Store`, `Storage`, `*Repo`, `SQL`, Postgres, MySQL, Mongo, Dynamo, Aurora, Spanner, Supabase, Firebase, BigQuery, Redshift, Snowflake, Cassandra, Neo4j, ClickHouse, Elastic, OpenSearch, Pinecone, Weaviate, `*Table` |
169
+ | cache | Dashed cylinder | `*Cache`, Redis, Memcache, KeyDB, Dragonfly, Hazelcast, Valkey |
170
+ | queue | Horizontal cylinder (pipe) | `*Queue`, `*MQ`, SQS, Kafka, RabbitMQ, `EventBus`, `*Bus`, `Topic`, `*Stream`, SNS, PubSub, NATS, Pulsar, Kinesis, EventBridge, Celery, Sidekiq, `*Channel`, `*Broker` |
171
+ | networking | Hexagon | `*Router`, `*Balancer`, `Gateway`, `Proxy`, `LB`, `CDN`, `Firewall`, `WAF`, `DNS`, `Ingress`, Nginx, Traefik, Envoy, Istio, Kong, Akamai, Cloudflare, `*Mesh` |
172
+ | frontend | Monitor (screen + stand) | `*App`, `Application`, `Mobile`, iOS, Android, `Web`, `Browser`, `Frontend`, `*UI`, `Dashboard`, `*CLI`, `Terminal`, React, Vue, Angular, Svelte, NextJS, Electron, Tauri, `*Widget`, `Portal`, `*Console`, SPA, PWA |
173
+ | gateway | Rectangle (same as default) | matched via `is a gateway` only |
174
+ | external | Dashed rectangle | `External`, `*Ext`, `ThirdParty`, `*3P`, `Vendor`, `Webhook`, `Upstream`, `Downstream`, `Callback`, AWS, GCP, Azure |
175
+ | default | Rectangle | Everything else (no `is a` needed) |
134
176
 
177
+ **Inference handles it (skip `is a`):**
178
+ ```
179
+ AuthService // service (matches *Service)
180
+ PostgresDB // database (matches *DB)
181
+ Redis // cache (exact match)
182
+ User // actor (exact match)
183
+ Kafka // queue (exact match)
184
+ API Gateway // networking (matches Gateway)
185
+ WebApp // frontend (matches *App)
186
+ Stripe // service (exact match)
135
187
  ```
136
- bar Revenue by Region
137
- series Revenue
138
188
 
139
- North 850
140
- South 620
141
- East 1100
142
- West 430
189
+ **Inference would miss (use `is a`):**
190
+ ```
191
+ Payments is a service // "Payments" matches no rule
192
+ Vault is a database // "Vault" infers as service, but you want database
193
+ Notifications is a queue // "Notifications" matches no rule
194
+ Analytics is a frontend // "Analytics" matches no rule
143
195
  ```
144
196
 
145
- Colors per item: `North(red) 850`
197
+ ### 2.2 Participant Groups
146
198
 
147
- ### line
199
+ ```
200
+ [Group Name]
201
+ Participant1
202
+ Participant2
203
+ ```
148
204
 
149
- **Syntax:** `line [Title]` or `multi-line [Title]`
205
+ - Pipe metadata goes outside brackets: `[Backend] | t: Eng`
206
+ - Invalid: `[Backend | t: Eng]` (pipe inside brackets)
150
207
 
151
- **Options:** `series`, `xlabel`, `ylabel`, `labels`
208
+ ### 2.3 Messages (Arrows)
152
209
 
153
- **Data format:** `Label value` (single series) or `Label v1, v2, v3` (multi-series matching `series` list)
210
+ | Type | Syntax | Example |
211
+ |------|--------|---------|
212
+ | Sync (labeled) | `A -label-> B` | `Client -login-> API` |
213
+ | Sync (bare) | `A -> B` | `Client -> API` |
214
+ | Async (labeled) | `A ~label~> B` | `API ~notify~> Queue` |
215
+ | Async (bare) | `A ~> B` | `API ~> Queue` |
154
216
 
155
- **Example:**
217
+ - Whitespace around arrows is optional: `A-label->B` works
218
+ - Labels can contain spaces, hyphens, special chars
219
+ - Labels cannot contain arrow chars (`->`, `~>`)
220
+ - Pipe metadata: `A -msg-> B | c: Caching`
156
221
 
157
- ```
158
- line Quarterly Performance
159
- series Sales(red), Costs(blue)
222
+ ### 2.4 Section Dividers
160
223
 
161
- Q1 100, 50
162
- Q2 120, 55
163
- Q3 110, 60
164
- Q4 130, 58
224
+ ```
225
+ == Label ==
226
+ == Label
165
227
  ```
166
228
 
167
- Multi-series: comma-separated values matching the `series` list. Single series omits `series` directive. Also works as `multi-line`.
229
+ Trailing `==` is optional.
168
230
 
169
- **Era bands** — annotate named time periods with background shading:
231
+ ### 2.5 Notes
170
232
 
171
233
  ```
172
- line U.S. Strategic Petroleum Reserve
173
- ylabel Million Barrels
234
+ note Text
235
+ note right Text
236
+ note left of ParticipantID Text
237
+ ```
174
238
 
175
- era '81 -> '89 Reagan (red)
176
- era '89 -> '93 Bush (red)
177
- era '93 -> '01 Clinton (blue)
239
+ **Multi-line notes** use an indented body below the `note` heading:
178
240
 
179
- '81 230
180
- '85 493
181
- '89 580
182
- '93 587
183
- '01 550
241
+ ```
242
+ note right of API
243
+ - First bullet point
244
+ - Second bullet point
245
+ **Bold text** and *italic text*
246
+ `inline code`
247
+ [link text](https://example.com)
248
+ https://example.com
184
249
  ```
185
250
 
186
- Syntax: `era <start> -> <end> <label> [(<color>)]`
187
-
188
- - `start` and `end` must exactly match category labels in the data
189
- - Color is optional; defaults to the palette's blue
190
- - Band label is hidden if the era spans fewer than 3 category slots
191
- - Works on `line`, `multi-line`, and `area` charts
192
- - Era boundary labels are always pinned visible on the x-axis even when auto-skip is active
251
+ Content formatting:
252
+ - `- ` prefix on indented lines = bullet points
253
+ - Inline markdown: `**bold**`, `*italic*`, `` `code` ``
254
+ - Links: `[text](url)` and bare URLs (auto-truncated in display)
193
255
 
194
- ### area
256
+ ### 2.6 Structural Blocks
195
257
 
196
- **Syntax:** `area [Title]`
258
+ ```
259
+ if condition
260
+ messages...
261
+ else if condition
262
+ messages...
263
+ else
264
+ messages...
197
265
 
198
- **Options:** same as `line`, including era bands
266
+ loop condition
267
+ messages...
199
268
 
200
- **Data format:** same as `line`
269
+ parallel label
270
+ messages...
271
+ ```
201
272
 
202
- Same syntax as `line`, including era bands. Renders as a filled area chart.
273
+ - `parallel` requires a label
274
+ - Blocks nest via indentation
203
275
 
204
- ### pie
276
+ ### 2.7 Sequence Options
205
277
 
206
- **Syntax:** `pie [Title]`
278
+ - `activations` / `no-activations`
279
+ - `collapse-notes` / `no-collapse-notes`
280
+ - `active-tag GroupName`
207
281
 
208
- **Options:** `labels` (`name`/`value`/`percent`/`full`)
282
+ ---
209
283
 
210
- **Data format:** `Label value`
284
+ ## 3. Infrastructure Diagrams
211
285
 
212
- **Example:**
286
+ ### 3.1 Declaration
213
287
 
214
288
  ```
215
- pie Market Share
216
- labels percent
217
-
218
- Company A 40
219
- Company B 35
220
- Company C 25
289
+ infra [Title]
221
290
  ```
222
291
 
223
- ### doughnut
224
-
225
- **Syntax:** `doughnut [Title]`
226
-
227
- **Options:** same as `pie`
228
-
229
- **Data format:** same as `pie`
292
+ ### 3.2 Nodes
230
293
 
231
- Same syntax as `pie`. Renders as a doughnut (ring) chart.
232
-
233
- ### polar-area
294
+ ```
295
+ NodeName
296
+ NodeName | key: value
297
+ ```
234
298
 
235
- **Syntax:** `polar-area [Title]`
299
+ Nodes are plain names. Capabilities come from properties (see 3.3), not type declarations.
236
300
 
237
- **Options:** same as `pie`
301
+ ### 3.3 Node Properties (Indented, Space-Separated, NO Colon)
238
302
 
239
- **Data format:** same as `pie`
303
+ ```
304
+ NodeName
305
+ latency-ms 50
306
+ max-rps 8000
307
+ uptime 99.99%
308
+ cache-hit 75%
309
+ description My API gateway
310
+ firewall-block 10%
311
+ instances 3
312
+ ```
240
313
 
241
- Same syntax as `pie`. Renders as a polar area (rose) chart.
314
+ Properties use a known schema with space-separated values:
242
315
 
243
- ### radar
316
+ | Property | Capability | Effect |
317
+ |----------|-----------|--------|
318
+ | `cache-hit` | Cache | % requests served from cache, reduces downstream RPS |
319
+ | `firewall-block` | Firewall/WAF | % requests blocked, reduces downstream RPS |
320
+ | `ratelimit-rps` | Rate limiter | Max RPS passed through |
321
+ | `latency-ms` | Latency | Adds to path latency |
322
+ | `uptime` | Availability | Multiplied along path for SLO |
323
+ | `instances` | Horizontal scaling | Multiplies capacity |
324
+ | `max-rps` | Capacity ceiling | Max RPS node handles |
325
+ | `cb-error-threshold` | Circuit breaker | Error rate trip threshold |
326
+ | `cb-latency-threshold-ms` | Circuit breaker | Latency trip threshold |
327
+ | `concurrency` | Concurrency limit | Max concurrent requests |
328
+ | `duration-ms` | Processing time | Time spent processing |
329
+ | `cold-start-ms` | Serverless | Cold start penalty |
330
+ | `buffer` | Queue | Buffer size |
331
+ | `drain-rate` | Queue | Consumption rate |
332
+ | `retention-hours` | Queue | Message retention |
333
+ | `partitions` | Queue | Partition count |
334
+ | `description` | Display | Description text |
244
335
 
245
- **Syntax:** `radar [Title]`
336
+ ### 3.4 Connections
246
337
 
247
- **Options:** (none)
338
+ | Type | Syntax |
339
+ |------|--------|
340
+ | Sync (bare) | `-> Target` |
341
+ | Sync (labeled) | `-/api-> Target` |
342
+ | Async (bare) | `~> Target` |
343
+ | Async (labeled) | `~event~> Target` |
248
344
 
249
- **Data format:** `Label value`
345
+ - Connection metadata: `| split: 50%, fanout: 3` (colons in pipe metadata)
346
+ - Indented under source node
250
347
 
251
- **Example:**
348
+ ### 3.5 Groups
252
349
 
253
350
  ```
254
- radar Team Skills
255
-
256
- Frontend 85
257
- Backend 70
258
- DevOps 60
259
- Design 90
260
- Testing 75
351
+ [Group Name]
352
+ [Group Name](color)
353
+ [Group Name] | key: value
261
354
  ```
262
355
 
263
- ### bar-stacked
264
-
265
- **Syntax:** `bar-stacked [Title]`
356
+ Bracket syntax only. Optional color and pipe metadata.
266
357
 
267
- **Options:** `series` (required), `xlabel`, `ylabel`, `orientation`
358
+ ### 3.6 Infra Options (Space-Separated, NO Colon)
268
359
 
269
- **Data format:** `Label v1, v2, v3` comma-separated values matching the `series` list
360
+ - `direction-tb` (boolean; default is LR)
361
+ - `default-latency-ms N`
362
+ - `default-rps N`
363
+ - `default-uptime DECIMAL`
364
+ - `slo-availability DECIMAL`
365
+ - `slo-p90-latency-ms N`
366
+ - `animate` / `no-animate`
270
367
 
271
- **Example:**
368
+ ### 3.7 Edge Nodes
272
369
 
273
370
  ```
274
- bar-stacked Budget Allocation
275
- series Engineering, Marketing, Sales
276
-
277
- Q1 100, 50, 30
278
- Q2 110, 55, 35
279
- Q3 105, 60, 40
371
+ edge
372
+ internet
280
373
  ```
281
374
 
282
- ### scatter
375
+ Special top-level entry points. `internet` only accepts `rps` property.
283
376
 
284
- **Syntax:** `scatter [Title]`
285
-
286
- **Options:** `labels` (`on`/`off`), `xlabel`, `ylabel`, `sizelabel`
377
+ ---
287
378
 
288
- **Data format:** `Label x, y` or `Label x, y, size` (bubble chart). Group with `[GroupName]` blocks.
379
+ ## 4. Flowchart Diagrams
289
380
 
290
- **Example:**
381
+ ### 4.1 Declaration
291
382
 
292
383
  ```
293
- scatter Performance Metrics
294
- labels on
295
- xlabel Experience (years)
296
- ylabel Output
297
-
298
- Alice 3, 85
299
- Bob 7, 92
300
- Carol 2, 70
384
+ flowchart [Title]
301
385
  ```
302
386
 
303
- Tag groups (`[GroupName](color)`) create colored clusters:
387
+ ### 4.2 Node Shapes
304
388
 
305
- ```
306
- scatter Startup Funding vs Revenue
307
- labels on
308
- xlabel Funding ($M)
309
- ylabel Annual Revenue ($M)
389
+ | Shape | Syntax | Example |
390
+ |-------|--------|---------|
391
+ | Terminal | `(Label)` | `(Start)` |
392
+ | Process | `[Label]` | `[Do Task]` |
393
+ | Decision | `<Label>` | `<Check?>` |
394
+ | I/O | `/Label/` | `/Read Input/` |
395
+ | Subroutine | `[[Label]]` | `[[Validate]]` |
396
+ | Document | `[Label~]` | `[Report~]` |
310
397
 
311
- [SaaS](blue)
312
- Acme Cloud 12, 8.5
313
- DataSync 5.2, 3.1
398
+ - Color suffix: `(Start(green))`
314
399
 
315
- [Fintech](green)
316
- PayFlow 45, 32
317
- LendTech 18, 12.5
318
- ```
400
+ ### 4.3 Arrows
319
401
 
320
- ### heatmap
402
+ | Type | Syntax |
403
+ |------|--------|
404
+ | Unlabeled | `->` |
405
+ | Labeled | `-label->` |
406
+ | Colored | `-(color)->` |
407
+ | Labeled + colored | `-label(color)->` |
321
408
 
322
- **Syntax:** `heatmap [Title]`
409
+ - Color inference: `yes/success/ok/true` infers green; `no/fail/error/false` infers red
323
410
 
324
- **Options:** `columns` (required)
325
-
326
- **Data format:** `Row Label v1, v2, v3` — comma-separated values matching the `columns` list
327
-
328
- **Example:**
411
+ ### 4.4 Groups
329
412
 
330
413
  ```
331
- heatmap Activity by Month
332
- columns Jan, Feb, Mar, Apr, May, Jun
333
-
334
- Team A 5, 4, 5, 3, 4, 5
335
- Team B 2, 3, 2, 4, 3, 2
336
- Team C 3, 2, 1, 2, 3, 4
414
+ [GroupName]
415
+ [Child nodes...]
337
416
  ```
338
417
 
339
- ### sankey
340
-
341
- **Syntax:** `sankey [Title]`
342
-
343
- **Options:** (none)
418
+ Bracket syntax only.
344
419
 
345
- **Data format:** Arrow syntax (`Source -> Target value`) or indentation syntax (`Target value` indented under parent)
346
-
347
- **Arrow syntax:**
420
+ ### 4.5 Inline Chains
348
421
 
349
422
  ```
350
- sankey Resource Flow
351
-
352
- Source A -> Processing 300
353
- Source B -> Processing 200
354
- Processing -> Output X 350
355
- Processing -> Output Y 150
423
+ (Start) -> [Step 1] -> [Step 2] -> (End)
356
424
  ```
357
425
 
358
- **Indentation syntax:**
426
+ ### 4.6 Options
359
427
 
360
- ```
361
- sankey Resource Flow
428
+ - `direction-lr` (boolean; default is TB)
429
+ - `orientation-vertical` (boolean; default is horizontal)
362
430
 
363
- Source A
364
- Processing 300
365
- Source B
366
- Processing 200
367
- Processing
368
- Output X 350
369
- Output Y 150
370
- ```
431
+ ---
371
432
 
372
- Both syntaxes can be mixed in the same diagram.
433
+ ## 5. State Diagrams
373
434
 
374
- **Node colors** — `(color)` after a node name:
435
+ ### 5.1 Declaration
375
436
 
376
437
  ```
377
- Revenue (green)
378
- Costs (red) 600
379
- Profit (blue) 400
380
-
381
- // or with arrows
382
- Revenue (green) -> Costs (red) 600
438
+ state [Title]
383
439
  ```
384
440
 
385
- **Link colors** — `(color)` after the value:
441
+ ### 5.2 States
386
442
 
387
443
  ```
388
- Revenue
389
- Costs 600 (orange)
390
-
391
- // or with arrows
392
- Revenue -> Costs 600 (orange)
444
+ StateName
445
+ StateName(color)
446
+ [*] // initial/final pseudostate
393
447
  ```
394
448
 
395
- ### chord
396
-
397
- **Syntax:** `chord [Title]`
398
-
399
- **Options:** (none)
449
+ ### 5.3 Transitions
400
450
 
401
- **Data format:** same as `sankey` (arrow syntax)
451
+ | Type | Syntax |
452
+ |------|--------|
453
+ | Unlabeled | `Idle -> Active` |
454
+ | Labeled | `Idle -submit-> Processing` |
455
+ | Colored | `Idle -(blue)-> Active` |
402
456
 
403
- Same syntax as `sankey`. Renders as a circular chord diagram.
404
-
405
- **Example:**
457
+ ### 5.4 Groups
406
458
 
407
459
  ```
408
- chord Inter-Department Collaboration
409
-
410
- Engineering -> Design 85
411
- Engineering -> Product 72
412
- Design -> Marketing 45
413
- Product -> Sales 42
460
+ [Group Name]
461
+ [Group Name](color)
414
462
  ```
415
463
 
416
- ### funnel
464
+ ### 5.5 Options
417
465
 
418
- **Syntax:** `funnel [Title]`
466
+ - `direction-tb` (boolean; default is LR)
419
467
 
420
- **Options:** (none)
468
+ ---
421
469
 
422
- **Data format:** `Label value`
470
+ ## 6. Org Charts
423
471
 
424
- **Example:**
472
+ ### 6.1 Declaration
425
473
 
426
474
  ```
427
- funnel Conversion Pipeline
428
-
429
- Visitors 1000
430
- Signups 500
431
- Trials 200
432
- Customers 100
475
+ org [Title]
433
476
  ```
434
477
 
435
- ### function
436
-
437
- **Syntax:** `function [Title]`
438
-
439
- **Options:** `x` (required, `start to end`), `xlabel`, `ylabel`
440
-
441
- **Data format:** `Name (color) expression` — math expressions using `x`
442
-
443
- **Example:**
478
+ ### 6.2 Nodes (Indentation = Hierarchy)
444
479
 
445
480
  ```
446
- function Mathematical Functions
447
- xlabel x
448
- ylabel f(x)
449
-
450
- x -6 to 6
451
- f(x) (blue) sin(x)
452
- g(x) (red) x^2 / 10
453
- h(x) (green) cos(x) * 2
481
+ CEO
482
+ CTO
483
+ Engineer1
484
+ Engineer2
485
+ CFO
454
486
  ```
455
487
 
456
- Expressions support: `+`, `-`, `*`, `/`, `^`, `sin`, `cos`, `sqrt`, `abs`, `log`, `exp`, `pi`, `e`.
457
-
458
- ### slope
459
-
460
- **Syntax:** `slope [Title]`
461
-
462
- **Options:** `orientation` (`horizontal`/`vertical`)
463
-
464
- **Data format:** First data line defines period labels. Subsequent lines: `Item (color) v1, v2, ...`
488
+ - Color suffix: `Alice(blue)`
489
+ - Pipe metadata: `Alice | role: CEO, t: Exec`
465
490
 
466
- **Example:**
491
+ ### 6.3 Metadata (Indented, Colon REQUIRED)
467
492
 
468
493
  ```
469
- slope Programming Language Popularity
470
-
471
- 2020, 2022, 2025
472
- Python (blue) 3, 1, 1
473
- JavaScript (yellow) 1, 2, 2
474
- TypeScript (cyan) 7, 4, 3
475
- Rust (orange) 18, 12, 5
494
+ Alice
495
+ role: Senior Engineer
496
+ location: NYC
476
497
  ```
477
498
 
478
- ### wordcloud
479
-
480
- **Syntax:** `wordcloud [Title]`
481
-
482
- **Options:** `rotate` (`none`/`mixed`/`angled`), `max` (word limit), `size` (`min, max` font range)
499
+ This is key-value metadata assignment, consistent with pipe metadata syntax.
483
500
 
484
- **Data format:** `word weight` (higher = larger)
485
-
486
- **Example:**
501
+ ### 6.4 Containers
487
502
 
488
503
  ```
489
- wordcloud Top Terms
490
-
491
- kubernetes 95
492
- docker 80
493
- terraform 65
494
- ansible 50
504
+ [Team Name]
505
+ members...
495
506
  ```
496
507
 
497
- ### arc
508
+ ### 6.5 Options
498
509
 
499
- **Syntax:** `arc [Title]`
510
+ - `direction-tb` (boolean; default is LR)
511
+ - `sub-node-label Text`
512
+ - `show-sub-node-count`
513
+ - `hide`
500
514
 
501
- **Options:** `order:` (`appearance`/`name`/`group`/`degree`), `orientation`
515
+ ---
502
516
 
503
- **Data format:** `Source -> Target weight`. Group nodes with `[GroupName]` blocks.
517
+ ## 7. C4 Architecture Diagrams
504
518
 
505
- **Example:**
519
+ ### 7.1 Declaration
506
520
 
507
521
  ```
508
- arc Team Collaboration
509
- order: group
510
-
511
- [Frontend]
512
- WebApp -> API Gateway 5
513
- MobileApp -> API Gateway 3
514
-
515
- [Core Services]
516
- API Gateway -> AuthService 4
517
- API Gateway -> UserService 5
522
+ c4 [Title]
518
523
  ```
519
524
 
520
- ### venn
521
-
522
- **Syntax:** `venn [Title]`
523
-
524
- **Options:** `values` (`on`/`off`)
525
-
526
- **Data format:** Sets: `id(color) alias shortname`. Overlaps: `id1 + id2 Label`.
527
-
528
- **Example:**
525
+ ### 7.2 Elements
529
526
 
530
527
  ```
531
- venn Skill Overlap
532
-
533
- Frontend(blue) alias fe
534
- Backend(green) alias be
535
- DevOps(orange) alias de
536
-
537
- fe + be Web Systems
538
- be + de Platform Ops
539
- fe + de Dev Tools
540
- fe + be + de Full Stack
528
+ Name is a <type>
529
+ Name is a container is a database // shape override
541
530
  ```
542
531
 
543
- ### quadrant
532
+ Types: `person`, `system`, `container`, `component`
533
+ Shape overrides: `database`, `cache`, `queue`, `cloud`, `external`
544
534
 
545
- **Syntax:** `quadrant [Title]`
546
-
547
- **Options:** `x-axis` (`low label, high label`), `y-axis` (`low label, high label`)
548
-
549
- **Data format:** Quadrant labels: `top-right Label`, `top-left Label`, etc. Data points: `Label (color) x, y` where x,y are 0-1.
550
-
551
- **Example:**
535
+ ### 7.3 Element Metadata (Indented, Colon REQUIRED)
552
536
 
553
537
  ```
554
- quadrant Priority Matrix
555
- x-axis Low Impact, High Impact
556
- y-axis Low Effort, High Effort
557
-
558
- top-right Quick Wins(green)
559
- top-left Big Bets(yellow)
560
- bottom-left Skip(red)
561
- bottom-right Reconsider(gray)
562
-
563
- Task A 0.9, 0.8
564
- Task B 0.2, 0.3
565
- Task C 0.7, 0.4
538
+ Web App is a container
539
+ description: SPA built with React
540
+ tech: React
566
541
  ```
567
542
 
568
- ### timeline
569
-
570
- **Syntax:** `timeline [Title]`
571
-
572
- **Options:** `scale` (`on`/`off`), `sort` (`time`/`group`/`tag`/`tag:GroupName`), `swimlanes` (`on`/`off`)
543
+ Indented metadata uses colon-separated `key: value`, consistent with org charts and pipe metadata.
573
544
 
574
- **Data format:** Ranges: `start->end Label | tag: Value`. Points: `date Label | tag: Value`.
575
-
576
- **Example:**
545
+ ### 7.4 Pipe Metadata (Colons in pipes)
577
546
 
578
547
  ```
579
- timeline Project History
580
-
581
- tag Team
582
- Team A(blue)
583
- Team B(green)
584
-
585
- era 2023->2024 Phase 1
586
- marker 2023-06 Launch(orange)
587
-
588
- 2023-01->2023-06 Planning | Team: Team A
589
- 2023-06->2024-01 Development | Team: Team A
590
- 2024-02 Release | Team: Team A
591
-
592
- 2023-03->2023-09 Research | Team: Team B
593
- 2023-09->2024-03? Implementation | Team: Team B
548
+ Web App is a container | description: SPA, tech: React
594
549
  ```
595
550
 
596
- Date formats: `YYYY`, `YYYY-MM`, `YYYY-MM-DD`. Ranges: `start->end`. Durations: `start->1y`, `start->6m`, `start->2w`, `start->30d`. Uncertain end: append `?` (e.g., `2024-03?`).
551
+ ### 7.5 Relationships
597
552
 
598
- Elements: `era start->end Label(color)`, `marker date Label(color)`, `tag` groups for interactive coloring.
553
+ | Type | Syntax |
554
+ |------|--------|
555
+ | Sync labeled | `-Makes API calls-> API` |
556
+ | Sync with tech | `-Uses [HTTPS]-> API` |
557
+ | Async labeled | `~Sends emails~> Email` |
599
558
 
600
- Tag groups for interactive coloring and swimlanes:
559
+ ### 7.6 Sections
601
560
 
602
561
  ```
603
- timeline Sprint Plan
604
- sort tag:Team
605
-
606
- tag Team
607
- Engineering(blue)
608
- Design(green)
609
-
610
- 2024-01->2024-06 Build API | Team: Engineering
611
- 2024-03->2024-05 UX Review | Team: Design
562
+ containers
563
+ ...
564
+ components
565
+ ...
566
+ deployment
567
+ container Web App // reference existing container
612
568
  ```
613
569
 
614
- Tag groups add interactive color and swimlane controls. `sort tag` uses the first tag group for swimlanes; `sort tag:GroupName` specifies which group (aliases work: `sort tag:p` resolves to `sort tag:Pirate`).
615
-
616
- ---
617
-
618
- ## Diagram Types
570
+ ### 7.7 Options
619
571
 
620
- ### sequence
572
+ - `direction-tb` (boolean; default is LR)
621
573
 
622
- **Syntax:** `sequence [Title]`
623
-
624
- **Options:** `activations` (`on`/`off`), `collapse-notes` (`yes`/`no`), `active-tag GroupName`
574
+ ---
625
575
 
626
- **Data format:** Messages between participants with arrow syntax
576
+ ## 8. Entity-Relationship Diagrams
627
577
 
628
- Minimal example:
578
+ ### 8.1 Declaration
629
579
 
630
580
  ```
631
- User -login-> API
632
- API -findUser-> DB
633
- DB -user-> API
634
- API -token-> User
581
+ er [Title]
635
582
  ```
636
583
 
637
- Full example:
584
+ ### 8.2 Tables
638
585
 
639
586
  ```
640
- sequence Authentication Flow
641
-
642
- // participant declarations (optional)
643
- User is an actor
644
- API is a service
645
- DB is a database
646
- NotifyQueue is a queue aka Notifications
647
-
648
- User -Login request-> API
649
- API -Find user by email-> DB
650
- DB -user record-> API
651
- note on DB
652
- Indexed lookup on email column
653
-
654
- if credentials valid
655
- API -Create session-> DB
656
- DB -session token-> API
657
- API ~session.created~> NotifyQueue
658
- API -200 OK + token-> User
659
- else
660
- API -401 Unauthorized-> User
661
-
662
- == Logout ==
663
-
664
- User -Logout-> API
665
- API -Delete session-> DB
666
- API -200 OK-> User
587
+ users
588
+ users(blue)
589
+ users | domain: Core
667
590
  ```
668
591
 
669
- **Participants**: Auto-inferred from message names. Declare explicitly for type/positioning:
670
- - `Name is a [actor|service|database|queue|cache|gateway|external|networking|frontend]`
671
- - `Name aka Display Label` — alias for display
672
- - `Name at position 2` — manual left-to-right ordering (0-based; negative from right)
673
-
674
- **Messages**:
675
- - Sync call: `A -label-> B` or `A -> B` (unlabeled) — always left-to-right
676
- - Async call: `A ~label~> B` or `A ~> B` (unlabeled)
677
-
678
- **Blocks** (indentation-scoped):
679
- - `if condition` ... `else` ... (no explicit `end` needed — indentation closes blocks)
680
- - `loop label` ...
681
- - `parallel label` ...
682
-
683
- **Notes**:
684
- - `note text` — standalone
685
- - `note on Participant` followed by indented text — anchored
686
- - Multi-line: indent continuation lines under `note`
687
-
688
- **Sections**: `== Section Title ==`
689
-
690
- **Groups**: `[Group Name]` or `[Group Name | key: value]` — visual grouping box around participants
592
+ - Pipe metadata on declaration line only
593
+ - Indented lines are columns or relationships
691
594
 
692
- **Tag groups** define color-coded metadata dimensions for interactive recoloring:
595
+ ### 8.3 Columns (Indented, Space-Separated, NO Colon)
693
596
 
694
597
  ```
695
- tag Concern alias c
696
- Caching(blue)
697
- Auth(green)
698
- BusinessLogic(purple) default
598
+ users
599
+ id int pk
600
+ name varchar
601
+ email string unique
602
+ created_at timestamp nullable
699
603
  ```
700
604
 
701
- - `tag Name` declares a tag group; `alias x` adds a shorthand
702
- - Each entry: `Value(color)` named color for that value
703
- - `default` on an entry applies it to untagged elements when the group is active
605
+ Format: `name [type] [constraints...]`
606
+ Constraints: `pk`, `fk`, `unique`, `nullable`
704
607
 
705
- **Pipe metadata** attach tag values to participants, messages, and groups:
608
+ ### 8.4 Relationships (Indented Under Source Table)
706
609
 
707
610
  ```
708
- API is a service | concern: Caching, team: Platform
709
- User -login-> API | concern: Auth
710
- [Backend | concern: BusinessLogic]
711
- OrderAPI
712
- DB
611
+ ships
612
+ 1-aboard-* crew_members
613
+ ?-frequents-1 ports
713
614
  ```
714
615
 
715
- - `| key: value` after participant declarations, message lines, or group headers
716
- - Multiple tags: `| key1: val1, key2: val2`
717
- - Aliases work: `| c: Caching` (if `alias c` was declared)
718
-
719
- **Tag resolution priority** (when a tag group is active):
720
- 1. Explicit metadata on the participant
721
- 2. Group propagation (participant inherits from its group)
722
- 3. Receiver inheritance (all incoming tagged messages agree on same value)
723
- 4. `default` entry value
724
- 5. Neutral (no color)
725
-
726
- **Legend** — rendered automatically above participants when tag groups exist. The active group expands to show colored entry dots. Click a group pill to activate it (in the desktop app).
616
+ Cardinality symbols: `1` (one), `*` (many), `?` (optional)
727
617
 
728
- ### flowchart
618
+ ### 8.5 Options
729
619
 
730
- **Syntax:** `flowchart [Title]`
620
+ - `notation chen` / `notation crow`
731
621
 
732
- **Options:** (none beyond `palette`, `theme`)
622
+ ---
733
623
 
734
- **Data format:** Node chains with arrow connections
624
+ ## 9. Class Diagrams
735
625
 
736
- Minimal example:
626
+ ### 9.1 Declaration
737
627
 
738
628
  ```
739
- (Start) -> [Process] -> (End)
629
+ class [Title]
740
630
  ```
741
631
 
742
- Full example:
632
+ ### 9.2 Classes
743
633
 
744
634
  ```
745
- flowchart Decision Process
746
-
747
- (Start) -> <Valid Input?>
748
- -yes-> [Process Data] -> [[Run Subroutine]]
749
- -no-> /Get User Input/ -> <Valid Input?>
750
- [[Run Subroutine]] -> [Document~] -> (Done)
635
+ Ship
636
+ abstract Vessel
637
+ interface Serializable
638
+ Ship extends Vessel
639
+ Galleon implements Serializable
640
+ ShipType enum
751
641
  ```
752
642
 
753
- **Node shapes**:
754
- - `(Terminal)` — oval
755
- - `[Process]` — rectangle
756
- - `<Decision?>` — diamond
757
- - `/Input Output/` — parallelogram
758
- - `[[Subroutine]]` — double-bordered rectangle
759
- - `[Document~]` — document (wavy bottom)
760
-
761
- **Arrows**: `-label-> Target`, `-(color)-> Target`, `-label(color)-> Target`
762
-
763
- **Inferred arrow colors** — when a label matches a well-known keyword, the arrow color is set automatically:
764
-
765
- | Label | Inferred Color |
766
- |---|---|
767
- | yes, success, ok, true | green |
768
- | no, fail, error, false | red |
769
- | maybe, warning | orange |
770
-
771
- Colors on nodes: `[Process(blue)]`
772
-
773
- ### state
774
-
775
- **Syntax:** `state [Title]`
776
-
777
- **Options:** `direction` (`TB` or `LR`), `color` (`off` for monochrome)
778
-
779
- **Data format:** States connected by transitions
780
-
781
- Minimal example:
643
+ ### 9.3 Members (Indented, Colon for Types)
782
644
 
645
+ **Fields:**
783
646
  ```
784
- [*] -> Idle -> Active -> [*]
647
+ + name: string
648
+ - speed: number
649
+ # protectedField: int
785
650
  ```
786
651
 
787
- Full example:
788
-
652
+ **Methods:**
789
653
  ```
790
- state Order Lifecycle
791
- direction LR
792
-
793
- [Processing(blue)]
794
- Validating -valid-> Approved
795
- Validating -invalid-> Rejected(red)
796
-
797
- [*] -> Pending -submit-> Validating
798
- Approved -ship-> Shipped -> [*]
799
- Rejected -> [*]
800
- Shipped -return-> Pending
654
+ + sail(): void
655
+ - calculate(x: number): boolean
656
+ + getName() {static}: string
801
657
  ```
802
658
 
803
- **States**: bare text `Idle`, `Active`, `Processing`. Optional color suffix: `Active(green)`.
659
+ Visibility: `+` public, `-` private, `#` protected
804
660
 
805
- **Pseudostates**: `[*]` — rendered as a filled circle. Use for start and end points.
661
+ **Enum values:**
662
+ ```
663
+ ShipType enum
664
+ Galleon
665
+ Sloop
666
+ ```
806
667
 
807
- **Transitions**: `->`, `-label->`, `-(color)->`, `-label(color)->`.
668
+ ### 9.4 Relationships (Indented Under Source Class)
808
669
 
809
- **Chains**: `A -> B -> C` on a single line creates two transitions.
670
+ | Relationship | Arrow |
671
+ |-------------|-------|
672
+ | Inheritance | `--|>` |
673
+ | Implementation | `..\|>` |
674
+ | Composition | `*--` |
675
+ | Aggregation | `o--` |
676
+ | Dependency | `..>` |
677
+ | Association | `->` |
810
678
 
811
- **Indentation**: indented lines use the parent as implicit source:
679
+ Relationships are indented under the source class:
812
680
 
813
681
  ```
814
- Idle
815
- -start-> Running
816
- -configure-> Configuring
682
+ Ship
683
+ --|> Vessel
684
+ *-- Cannon
817
685
  ```
818
686
 
819
- is equivalent to `Idle -start-> Running` and `Idle -configure-> Configuring`.
687
+ Optional label: `--|> Vessel : extends` (colon optional before label)
820
688
 
821
- **Groups**: `[GroupName]` or `[GroupName(color)]` groups subsequent indented states visually.
689
+ `extends` and `implements` on class declarations still work as part of the declaration syntax.
822
690
 
823
- **Self-loops**: `Running -retry-> Running` — a state transitioning to itself.
691
+ ### 9.5 Options
824
692
 
825
- ### class
693
+ - `no-auto-color` (boolean; auto-coloring is on by default)
826
694
 
827
- **Syntax:** `class [Title]`
828
-
829
- **Options:** (none beyond `palette`, `theme`)
695
+ ---
830
696
 
831
- **Data format:** Class declarations with indented members
697
+ ## 10. Kanban Boards
832
698
 
833
- Minimal example:
699
+ ### 10.1 Declaration
834
700
 
835
701
  ```
836
- Animal
837
- + name: string
838
- + speak(): void
839
-
840
- Dog extends Animal
841
- + breed: string
842
-
843
- Cat extends Animal
844
- + indoor: boolean
702
+ kanban [Title]
845
703
  ```
846
704
 
847
- Full example:
705
+ ### 10.2 Columns
848
706
 
849
707
  ```
850
- class Type Hierarchy
851
-
852
- Printable [interface]
853
- + print(): void
854
-
855
- Shape implements Printable [abstract]
856
- # x: number
857
- # y: number
858
- + area(): number
859
- count: number {static}
860
-
861
- Circle extends Shape
862
- - radius: number
863
- + area(): number
864
-
865
- Rectangle extends Shape
866
- - width: number
867
- - height: number
868
-
869
- Shape *-- Circle : contains
708
+ [Column Name]
709
+ [Column Name](color) | wip: 3
870
710
  ```
871
711
 
872
- **Class modifiers**: `[abstract]`, `[interface]`, `[enum]`
712
+ ### 10.3 Cards (Indented Under Columns)
873
713
 
874
- **Inheritance**: `ClassName extends Parent` or `ClassName implements Interface` — declared inline in the class header. Members are indented below.
875
-
876
- **Member visibility**: `+` public, `#` protected, `-` private. Static: `{static}`.
877
-
878
- **Relationships** (arrow syntax):
879
- - Inheritance: `A --|> B`
880
- - Implementation: `A ..|> B`
881
- - Composition: `A *-- B`
882
- - Aggregation: `A o-- B`
883
- - Dependency: `A ..> B`
884
- - Association: `A -> B`
885
- - Optional label: `A *-- B : description`
714
+ ```
715
+ [To Do]
716
+ Card title | priority: High, c: Owner
717
+ Detail text (indented deeper)
718
+ ```
886
719
 
887
- ### er
720
+ ### 10.4 Options
888
721
 
889
- **Syntax:** `er [Title]`
722
+ - `no-auto-color` (boolean; auto-coloring is on by default)
723
+ - `hide`
890
724
 
891
- **Options:** (none beyond `palette`, `theme`)
725
+ ---
892
726
 
893
- **Data format:** Entity declarations with indented columns and relationships
727
+ ## 11. Initiative-Status Diagrams
894
728
 
895
- Minimal example:
729
+ ### 11.1 Declaration
896
730
 
897
731
  ```
898
- users
899
- id: int [pk]
900
- name: varchar
901
- 1-* posts
902
-
903
- posts
904
- id: int [pk]
905
- user_id: int [fk]
732
+ initiative-status [Title]
906
733
  ```
907
734
 
908
- Full example:
735
+ ### 11.2 Nodes
909
736
 
910
737
  ```
911
- er Blog Schema
912
-
913
- users
914
- id: int [pk]
915
- email: varchar [unique]
916
- name: varchar
917
- 1-writes-* posts
918
- ?-moderates-* categories
919
-
920
- posts
921
- id: int [pk]
922
- title: varchar
923
- body: text
924
- author_id: int [fk]
925
- category_id: int [fk, nullable]
926
-
927
- categories
928
- id: int [pk]
929
- name: varchar [unique]
930
- 1-* posts
738
+ NodeLabel | status, key: value
739
+ NodeLabel | done, t: Team1
931
740
  ```
932
741
 
933
- **Columns**: `name: type [constraints]`. Constraints: `pk`, `fk`, `unique`, `nullable`. Multiple: `[fk, nullable]`.
934
-
935
- **Relationships** — indented under the source table (preferred):
936
- - `1-* target` — one-to-many
937
- - `1-1 target` — one-to-one
938
- - `?-1 target` — zero-or-one to one
939
- - `?-* target` — zero-or-more
940
- - Labeled: `1-writes-* target` (label between dashes)
941
-
942
- Columns and relationships can be mixed under the same table. The parser distinguishes them by the leading cardinality character (`1`, `*`, `?`).
943
-
944
- **Flat relationships** — at indent 0 (also supported):
945
- - `table1 1--* table2` — one-to-many
946
- - `table1 1--* table2 : label` — with label
742
+ Status values and equivalences:
947
743
 
948
- ### c4
744
+ | User writes | Canonical | Display |
745
+ |------------|-----------|---------|
746
+ | `done` | `done` | Done |
747
+ | `doing` | `doing` | In Progress |
748
+ | `wip` | `doing` | In Progress |
749
+ | `blocked` | `blocked` | Blocked |
750
+ | `paused` | `blocked` | Blocked |
751
+ | `waiting` | `blocked` | Blocked |
752
+ | `todo` | `todo` | To Do |
753
+ | `na` | `na` | N/A |
754
+ | (omitted) | `na` | N/A |
949
755
 
950
- **Syntax:** `c4 [Title]`
951
-
952
- **Options:** (none beyond `palette`, `theme`)
953
-
954
- **Data format:** Element declarations with `Name is a type`, relationships with arrows
955
-
956
- Minimal example:
756
+ ### 11.3 Edges
957
757
 
958
758
  ```
959
- c4
960
-
961
- User is a person
962
- MyApp is a system | description: The main application
963
- -Uses-> User
759
+ Source -> Target
760
+ Source -label-> Target
761
+ Source -> Target | status
964
762
  ```
965
763
 
966
- Auto-detection: C4 diagrams are auto-detected when `Name is a person/system/container/component` declarations are present — `c4` is optional.
967
-
968
- Full example:
969
-
764
+ Indented shorthand (source from preceding node):
765
+ ```
766
+ Captain | t: Bridge
767
+ -issueOrders-> CrewApp | na
970
768
  ```
971
- c4 Banking System
972
769
 
973
- tag Scope alias sc
974
- Internal(blue) default
975
- External(gray)
770
+ ### 11.4 Groups
976
771
 
977
- Customer is a person | description: A customer of the bank
772
+ ```
773
+ [Group Name]
774
+ indented nodes...
775
+ ```
978
776
 
979
- Internet Banking is a system | description: Online banking portal
980
- -Delivers content-> Customer | tech: HTTPS
981
- -Sends emails-> Email | tech: SMTP
777
+ ### 11.5 Options
982
778
 
983
- containers
984
- Web App is a container | description: SPA, tech: React
985
- -API calls-> API | tech: JSON/HTTPS
779
+ - `active-tag GroupName`
780
+ - `hide phase:Planning, phase:Review` (colon syntax for tag:value)
986
781
 
987
- API is a container | description: Backend, tech: Node.js
988
- -Reads/writes-> Database | tech: SQL
782
+ ---
989
783
 
990
- Database is a container | description: Data store, tech: PostgreSQL
784
+ ## 12. Sitemap Diagrams
991
785
 
992
- Email is a system | description: Email delivery, sc: External
993
- ~Sends emails~> Customer
786
+ ### 12.1 Declaration
994
787
 
995
- deployment
996
- Vercel is a cloud
997
- container Web App
998
- Railway
999
- container API
1000
- Neon is a database
1001
- container Database
788
+ ```
789
+ sitemap [Title]
1002
790
  ```
1003
791
 
1004
- **Element types** declared with `Name is a <type>`:
1005
- - `Name is a person` — human actor
1006
- - `Name is a system` — software system
1007
- - `Name is a container` — application/service within a system
1008
- - `Name is a component` — component within a container
1009
- - `Name is a external` — external system
1010
- - `Name is a database` — database element
792
+ ### 12.2 Pages (Indentation = Hierarchy)
1011
793
 
1012
- **Metadata** (pipe-delimited): `Name is a system | description: text, tech: stack, tagalias: value`
794
+ ```
795
+ Home
796
+ About
797
+ Pricing | Auth: Public
798
+ Enterprise
799
+ Blog
800
+ ```
1013
801
 
1014
- **Sections**: `containers` (inside system), `components` (inside container), `deployment`
802
+ ### 12.3 Arrows
1015
803
 
1016
- **Deployment nodes**: `NodeName is a [cloud|database|cache|queue|external]`
804
+ ```
805
+ Home
806
+ -pricing-> Pricing
807
+ -login-> Login
808
+ ```
1017
809
 
1018
- **Relationships**:
1019
- - Sync: `-> Target` or `-label-> Target`
1020
- - Async: `~> Target` or `~label~> Target`
1021
- - With technology metadata: `-label-> Target | tech: HTTPS`
810
+ ### 12.4 Containers
1022
811
 
1023
- **Tag groups**: See tag group syntax below.
812
+ ```
813
+ [Marketing]
814
+ Pricing | Auth: Public
815
+ ```
1024
816
 
1025
- ### org
817
+ ### 12.5 Options
1026
818
 
1027
- **Syntax:** `org [Title]`
819
+ - `direction-tb` (boolean; default is LR)
1028
820
 
1029
- **Options:** `sub-node-label`, `show-sub-node-count` (flag, no value needed)
821
+ ---
1030
822
 
1031
- **Data format:** Hierarchy via indentation
823
+ ## 13. Gantt Charts
1032
824
 
1033
- Minimal example:
825
+ ### 13.1 Declaration
1034
826
 
1035
827
  ```
1036
- org
1037
-
1038
- CEO
1039
- VP Engineering
1040
- Team Lead
1041
- VP Marketing
828
+ gantt [Title]
1042
829
  ```
1043
830
 
1044
- Full example:
831
+ ### 13.2 Options (Space-Separated, NO Colon)
1045
832
 
1046
833
  ```
1047
- org Engineering Org
1048
- sub-node-label Reports
1049
- show-sub-node-count
1050
-
1051
- tag Level alias lv
1052
- Director(red)
1053
- Manager(blue)
1054
- IC(green) default
1055
-
1056
- CTO | lv: Director
1057
- VP Engineering | lv: Director
1058
- [Platform]
1059
- Lead | lv: Manager
1060
- Dev 1
1061
- Dev 2
1062
- [Product]
1063
- Lead | lv: Manager
1064
- Dev 3
834
+ start 2026-03-15
835
+ today-marker
836
+ today-marker 2026-03-27
837
+ critical-path
838
+ no-dependencies
839
+ sort tag:Team
1065
840
  ```
1066
841
 
1067
- Hierarchy via indentation. `[Group Name]` creates collapsible sub-groups.
842
+ ### 13.3 Holidays
1068
843
 
1069
- **Metadata**: `Name | tagalias: value, tag2: value2`
1070
-
1071
- **Imports**: `import path/to/file.dgmo` (indented under a parent node), `tags path/to/tags.dgmo` (top-level).
844
+ ```
845
+ holiday
846
+ 2024-02-19 Presidents Day
847
+ 2024-05-27 -> 2024-05-29 Memorial Weekend
848
+ ```
1072
849
 
1073
- ### kanban
850
+ ### 13.4 Workweek
1074
851
 
1075
- **Syntax:** `kanban [Title]`
852
+ ```
853
+ workweek mon-fri
854
+ workweek sun-thu
855
+ ```
1076
856
 
1077
- **Options:** (none beyond `palette`, `theme`)
857
+ Top-level directive (not nested under `holiday`).
1078
858
 
1079
- **Data format:** `[Column]` headers with card items below
859
+ ### 13.5 Eras
1080
860
 
1081
- Minimal example:
861
+ **Flat form:**
862
+ ```
863
+ era 2026-04-06 -> 2026-04-10 Conference (purple)
864
+ ```
1082
865
 
866
+ **Block form:**
867
+ ```
868
+ era
869
+ 2026-04-06 -> 2026-04-10 Conference (purple)
870
+ 2026-06-01 -> 2026-06-05 Sprint Review (blue)
1083
871
  ```
1084
- kanban
1085
872
 
1086
- [To Do]
1087
- Task 1
1088
- Task 2
873
+ ### 13.6 Markers
1089
874
 
1090
- [Done]
1091
- Task 3
875
+ **Flat form:**
876
+ ```
877
+ marker 2026-03-27 Board Review
1092
878
  ```
1093
879
 
1094
- Full example:
1095
-
880
+ **Block form:**
881
+ ```
882
+ marker
883
+ 2026-03-27 Board Review
884
+ 2026-06-15 Release (green)
1096
885
  ```
1097
- kanban Sprint Board
1098
886
 
1099
- tag Priority
1100
- Critical(red)
1101
- High(orange)
1102
- Low(green) default
887
+ ### 13.7 Groups (Swimlanes)
1103
888
 
1104
- tag Owner alias o
1105
- Alice(blue)
1106
- Bob(green)
889
+ ```
890
+ [Backend] | t: Engineering
891
+ ```
1107
892
 
1108
- [Backlog(gray)]
1109
- Research API options | priority: High, o: Alice
893
+ Bracket syntax only.
1110
894
 
1111
- [In Progress(orange)] | wip: 3
1112
- Build auth module | priority: Critical, o: Bob
1113
- Integrate OAuth2
1114
- Add session management
895
+ ### 13.8 Tasks
1115
896
 
1116
- [Done(green)]
1117
- Setup CI pipeline | priority: High, o: Alice
897
+ ```
898
+ 20bd Database Schema | p: Foundation, 100%
899
+ 10bd API Integration | t: Engineering
900
+ 0d Launch Day
901
+ 2026-03-15 -> 30d Setup
1118
902
  ```
1119
903
 
1120
- **Columns**: `[Column Name]`, `[Column Name(color)]`, `[Column Name] | wip: N`
904
+ Duration units: `min`, `h`, `d`, `bd` (business days), `w`, `m`, `q`, `y`
905
+ Uncertain: `10bd?` (trailing `?`)
906
+ Progress: `| 80%` in pipe metadata
1121
907
 
1122
- **Cards**: `Card Title | tag: value`. Indented lines below become card details.
908
+ ### 13.9 Dependencies (Indented Under Tasks)
1123
909
 
1124
- **Group metadata cascading**: `[Column Name] | key: value` — pipe metadata on column headers cascades to all cards in the column.
910
+ ```
911
+ 10bd API Integration
912
+ -> E2E Testing
913
+ -> Launch Day | offset: 10bd
914
+ ```
1125
915
 
1126
- ### initiative-status
916
+ ### 13.10 Parallel Block
1127
917
 
1128
- **Syntax:** `initiative-status [Title]`
918
+ ```
919
+ parallel
920
+ [Backend]
921
+ 20bd Schema
922
+ [Frontend]
923
+ 10bd Wireframes
924
+ ```
1129
925
 
1130
- **Options:** (none beyond `palette`, `theme`)
926
+ ---
1131
927
 
1132
- **Data format:** Nodes with status, connected by dependency arrows
928
+ ## 14. Timeline Diagrams
1133
929
 
1134
- Minimal example:
930
+ ### 14.1 Declaration
1135
931
 
1136
932
  ```
1137
- initiative-status
1138
-
1139
- Auth | done
1140
- -> UserService | doing
1141
- -> NotifyService | todo
1142
- UserService | doing
1143
- NotifyService | todo
933
+ timeline [Title]
1144
934
  ```
1145
935
 
1146
- Full example:
936
+ ### 14.2 Events
1147
937
 
938
+ **Point event:**
1148
939
  ```
1149
- initiative-status Platform Roadmap
1150
-
1151
- Auth | done
1152
- -depends-> UserService | doing
1153
- -feeds-> Dashboard | todo
1154
- Dashboard | todo
1155
- UserService | doing
1156
- -calls-> DBLayer | done
1157
- DBLayer | done
1158
-
1159
- [External]
1160
- PaymentGW | na
1161
- EmailProvider | na
940
+ 1718-05 Blockades Charleston | p: Blackbeard
1162
941
  ```
1163
942
 
1164
- **Status values**: `done`, `doing`, `blocked`, `todo`, `na`
1165
-
1166
- **Status aliases**: `wip` maps to `doing`; `paused` and `waiting` map to `blocked`. Aliases are accepted in input but the canonical values are preferred.
1167
-
1168
- **Relationships**: `-label-> Target | status` or indented children.
1169
-
1170
- **Groups**: `[Group Name]` for visual grouping. `[Group Name] | key: value` — pipe metadata cascades to contained nodes.
1171
-
1172
- ### sitemap
943
+ **Range event:**
944
+ ```
945
+ 1716 -> 1717 Sails under Hornigold | p: Blackbeard
946
+ ```
1173
947
 
1174
- **Syntax:** `sitemap [Title]`
948
+ **Duration event:**
949
+ ```
950
+ 2026-03-20 -> 30d Sprint 1
951
+ ```
1175
952
 
1176
- **Options:** `direction` (`TB` or `LR`), `orientation` (alias for `direction`)
953
+ **Uncertain ending:**
954
+ ```
955
+ 1718 -> 1719? Rackham builds crew
956
+ ```
1177
957
 
1178
- **Data format:** Page labels with arrows and metadata
958
+ Date formats: `YYYY`, `YYYY-MM`, `YYYY-MM-DD`, `YYYY-MM-DD HH:MM`
959
+ Duration units: `min`, `h`, `d`, `w`, `m`, `y`
1179
960
 
1180
- Minimal example:
961
+ ### 14.3 Eras
1181
962
 
963
+ **Flat form:**
1182
964
  ```
1183
- sitemap
1184
-
1185
- Home
1186
- -about-> About
1187
- -blog-> Blog
1188
-
1189
- [Content]
1190
- About
1191
- Blog
1192
- -read-> Post
1193
- Post
965
+ era 1716 -> 1718 Nassau Republic
1194
966
  ```
1195
967
 
1196
- Full example:
1197
-
968
+ **Block form:**
969
+ ```
970
+ era
971
+ 1716 -> 1718 Nassau Republic
972
+ 1718 -> 1720 Woodes Rogers Era (orange)
1198
973
  ```
1199
- sitemap SaaS Platform
1200
- direction TB
1201
-
1202
- tag Auth
1203
- Public(green)
1204
- Required(blue)
1205
- Admin(red)
1206
974
 
1207
- tag Type
1208
- Landing(purple)
1209
- Form(orange)
1210
- Content(cyan)
975
+ ### 14.4 Markers
1211
976
 
1212
- Home
1213
- Auth: Public
1214
- Type: Landing
1215
- -pricing-> Pricing
1216
- -login-> Login
1217
- -docs-> Docs
977
+ **Flat form:**
978
+ ```
979
+ marker 1718-07 Woodes Rogers arrives (orange)
980
+ ```
1218
981
 
1219
- [Marketing]
1220
- Pricing
1221
- Auth: Public
1222
- Type: Content
1223
- -sign up-> Register
982
+ **Block form:**
983
+ ```
984
+ marker
985
+ 1718-07 Woodes Rogers arrives (orange)
986
+ 1720-01 End of Golden Age (red)
987
+ ```
1224
988
 
1225
- Docs
1226
- Auth: Public
1227
- Type: Content
989
+ ### 14.5 Groups
1228
990
 
1229
- [Auth]
1230
- Login
1231
- Auth: Public
1232
- Type: Form
1233
- -success-> Dashboard
1234
- -forgot-> Reset Password
991
+ ```
992
+ [Royal Navy]
993
+ 1718-07 Woodes Rogers arrives
994
+ ```
1235
995
 
1236
- Register
1237
- Auth: Public
1238
- Type: Form
1239
- -success-> Dashboard
996
+ ---
1240
997
 
1241
- Reset Password
1242
- Auth: Public
1243
- Type: Form
1244
- -submitted-> Login
998
+ ## 15. Data Charts
1245
999
 
1246
- [App]
1247
- Dashboard
1248
- Auth: Required
1249
- Type: Landing
1250
- -projects-> Projects
1251
- -settings-> Settings
1000
+ ### 15.1 Simple Charts (bar, line, pie, doughnut, area, polar-area, radar, bar-stacked)
1252
1001
 
1253
- Projects
1254
- Auth: Required
1255
- Type: Content
1002
+ **Declaration:** `bar [Title]`, `line [Title]`, etc.
1256
1003
 
1257
- Settings
1258
- Auth: Required
1259
- Type: Form
1260
- -saved-> Dashboard
1004
+ **Series:**
1005
+ ```
1006
+ series Name1 Name2
1007
+ series
1008
+ Name1
1009
+ Name2(color)
1261
1010
  ```
1262
1011
 
1263
- **Pages**: Plain labels at any indent level become page nodes.
1264
-
1265
- **Groups**: `[Group Name]` wraps indented children in a container.
1266
-
1267
- **Arrows**: `-label-> Target`, `-(color)-> Target`, `-label(color)-> Target` — cross-link between any pages. Arrow colors are inferred from well-known labels (see flowchart section).
1012
+ Commas between series names are optional.
1268
1013
 
1269
- **Metadata**: `Key: Value` lines attach to the parent page (displayed as card rows).
1014
+ **Data rows (space-separated, NO colon):**
1015
+ ```
1016
+ Label 100
1017
+ Label 100 200 300
1018
+ Label(color) 100
1019
+ ```
1270
1020
 
1271
- **Tag groups**: `tag Name` with colored entries same syntax as org charts.
1021
+ Commas between values are optional. Thousands commas are supported (`3,984,078.65` is a valid number).
1272
1022
 
1273
- **Direction**: `direction TB` (top-to-bottom, default) or `direction LR` (left-to-right). `orientation` is accepted as an alias for `direction`.
1023
+ **Options (space-separated, NO colon):**
1024
+ ```
1025
+ title My Chart
1026
+ x-label X Label
1027
+ y-label Y Label
1028
+ orientation-horizontal
1029
+ stacked
1030
+ ```
1274
1031
 
1275
- **Group metadata cascading**: `[Group Name] | key: value` pipe metadata on group headers cascades to all pages in the group.
1032
+ - `orientation-horizontal` (boolean; default is vertical bars)
1033
+ - `stacked` (boolean; default is off)
1034
+ - Legend is always shown (no option needed)
1276
1035
 
1277
- **Collapsible groups**: Groups can be collapsed/expanded in the app arrows to hidden pages re-terminate at the group boundary.
1036
+ **Labels** default to showing all parts (name + value + percent for pie-family). Disable parts individually:
1037
+ - `no-label-name` — hide name
1038
+ - `no-label-value` — hide value
1039
+ - `no-label-percent` — hide percent
1278
1040
 
1279
- ### infra
1041
+ **Eras (line/area only):**
1042
+ ```
1043
+ era Day 1 -> Day 3 Rough Seas (red)
1044
+ ```
1280
1045
 
1281
- **Syntax:** `infra [Title]`
1046
+ ### 15.2 Scatter / Bubble Charts
1282
1047
 
1283
- **Options:** `direction` (`LR` or `TB`), `orientation` (alias for `direction`)
1048
+ **Data rows (space-separated, NO colon):**
1049
+ ```
1050
+ Name x y
1051
+ Name x y size
1052
+ ```
1284
1053
 
1285
- **Data format:** Component declarations with indented properties and connections
1054
+ Commas between values are optional. Thousands commas supported.
1286
1055
 
1287
- Minimal example:
1056
+ **Categories:**
1057
+ ```
1058
+ [Caribbean](red)
1059
+ Blackbeard 90 8500
1060
+ ```
1288
1061
 
1062
+ **Options:**
1063
+ ```
1064
+ x-label Weight
1065
+ y-label Height
1066
+ size-label Crew
1067
+ no-labels
1289
1068
  ```
1290
- infra
1291
1069
 
1292
- edge
1293
- rps: 1000
1294
- -> CDN
1070
+ Labels are on by default. Use `no-labels` to hide point names.
1295
1071
 
1296
- CDN
1297
- cache-hit: 80%
1298
- -> API
1072
+ ### 15.3 Heatmap
1299
1073
 
1300
- API
1301
- instances: 2
1302
- max-rps: 400
1303
- latency-ms: 30
1074
+ **Columns:**
1075
+ ```
1076
+ columns Jan Feb Mar
1304
1077
  ```
1305
1078
 
1306
- Full example:
1079
+ Commas between column names are optional.
1307
1080
 
1081
+ **Data rows (space-separated, NO colon):**
1082
+ ```
1083
+ RowLabel 5 4 3
1308
1084
  ```
1309
- infra Production Traffic Flow
1310
- direction LR
1311
1085
 
1312
- tag Team alias t
1313
- Backend(blue)
1314
- Platform(teal)
1086
+ Commas between values are optional. Thousands commas supported.
1315
1087
 
1316
- edge
1317
- rps: 10000
1318
- -> CloudFront
1088
+ ### 15.4 Function Charts (Colon REQUIRED)
1319
1089
 
1320
- CloudFront | t: Platform
1321
- cache-hit: 80%
1322
- -> CloudArmor
1090
+ ```
1091
+ function Trajectories
1092
+ x-label Distance
1093
+ y-label Height
1094
+ x 0 to 250
1323
1095
 
1324
- CloudArmor | t: Platform
1325
- firewall-block: 5%
1326
- -> ALB
1096
+ 15 degrees(blue): -0.001*x^2 + 0.27*x
1097
+ 45 degrees(red): -0.003*x^2 + 0.75*x
1098
+ ```
1327
1099
 
1328
- ALB | t: Platform
1329
- -/api-> [API Pods] | split: 60%
1330
- -/purchase-> [Commerce Pods] | split: 30%
1331
- -/static-> StaticServer | split: 10%
1100
+ The colon between name and expression is **required** — both sides can contain spaces, so colon is the unambiguous delimiter.
1332
1101
 
1333
- [API Pods]
1334
- APIServer | t: Backend
1335
- instances: 3
1336
- max-rps: 500
1337
- latency-ms: 45
1338
- cb-error-threshold: 50%
1102
+ **Options:**
1103
+ - `shade` (boolean; off by default, shades area below curves when enabled)
1339
1104
 
1340
- [Commerce Pods]
1341
- PurchaseMS
1342
- instances: 1-8
1343
- max-rps: 300
1344
- latency-ms: 120
1105
+ ### 15.5 Sankey Charts
1345
1106
 
1346
- StaticServer | t: Platform
1347
- latency-ms: 5
1107
+ **Tree structure (indented, space-separated):**
1108
+ ```
1109
+ Sugar Plantations(green)
1110
+ Tortuga Distillery(orange) 3000
1111
+ Nassau Distillery 2500
1348
1112
  ```
1349
1113
 
1350
- **Entry point**: The `edge` block declares the external traffic source with `rps:` (requests per second). All downstream rps are computed automatically.
1114
+ **Explicit links:**
1115
+ ```
1116
+ Source -> Target 3500
1117
+ Source -- Target 2000
1118
+ ```
1351
1119
 
1352
- **Components**: Bare labels at indent 0 define infrastructure components. Properties are indented below:
1353
- - `cache-hit: N%` — percentage of traffic served from cache (reduces downstream flow)
1354
- - `firewall-block: N%` — percentage of traffic blocked (reduces downstream flow)
1355
- - `ratelimit-rps: N` — maximum rps allowed through (excess dropped)
1356
- - `max-rps: N` — maximum rps capacity per instance
1357
- - `instances: N` or `instances: N-M` — fixed or auto-scaling instance count
1358
- - `latency-ms: N` — per-request latency in milliseconds
1359
- - `cb-error-threshold: N%` — circuit breaker opens when overload exceeds this ratio
1360
- - `cb-latency-threshold-ms: N` — circuit breaker opens when cumulative latency exceeds this
1120
+ `->` = directed, `--` = undirected. Thousands commas supported in values.
1361
1121
 
1362
- **Type declarations**: `NodeName is a <type>` — declare a component's infrastructure role:
1363
- - `database`, `cache`, `queue`, `service`, `gateway`, `storage`, `function`, `network`
1364
- - Example: `Redis is a cache`, `SQS is a queue`
1122
+ ### 15.6 Chord Charts
1365
1123
 
1366
- **Connections**:
1367
- - Sync: `-> Target` (unlabeled), `-label-> Target` (labeled)
1368
- - Async: `~> Target` (unlabeled), `~label~> Target` (labeled)
1369
- - Pipe metadata for splits: `-> Target | split: N%`
1370
- - Fan-out multiplier: `-> Target | fanout: 5` or `-> Target | split: 50%, fanout: 5`
1124
+ ```
1125
+ Blackbeard -- Bonnet 150 // undirected
1126
+ Roberts -> Rackham 20 // directed
1127
+ ```
1371
1128
 
1372
- **Fan-out**: Use `| fanout: N` metadata to model request multiplication — one inbound request triggers N outbound calls to the target. The target receives `inbound x N` RPS. Fan-out is applied after split: `-> Shards | split: 60%, fanout: 8` means the target receives `inbound x 0.60 x 8` RPS. Fan-out compounds naturally through multi-hop chains.
1129
+ Thousands commas supported in values.
1373
1130
 
1374
- **Branching**: Multiple outbound connections with `split: N%` metadata. Splits must sum to 100%. Undeclared splits are evenly distributed from the remaining percentage.
1131
+ ### 15.7 Funnel Charts
1375
1132
 
1376
- **Groups**: `[Group Name]` with indented children — rendered as dashed-border containers. Edges targeting a group route to all children.
1133
+ **Data rows (space-separated, NO colon):**
1134
+ ```
1135
+ Visits 1200
1136
+ Signups 800
1137
+ Purchases 200
1138
+ ```
1377
1139
 
1378
- **Roles**: Inferred automatically from behavior properties or `is a` type declarations. Components with `cache-hit` get a Cache role, `firewall-block` gets Firewall, etc. Explicit declarations (`Redis is a cache`) set the role directly. Roles appear as colored dots on nodes and in the legend.
1140
+ Thousands commas supported.
1379
1141
 
1380
- **Overload**: When computed rps exceeds `max-rps x instances`, the node turns red. Dynamic scaling (`instances: 1-8`) auto-scales within the range before overloading.
1142
+ ---
1381
1143
 
1382
- **Group metadata cascading**: `[Group Name] | key: value` — pipe metadata on group headers cascades to all children, providing default tag values for contained nodes.
1144
+ ## 16. Visualizations
1383
1145
 
1384
- **Tag groups**: Same syntax as org/kanban/sitemap `tag Name alias x` with colored entries.
1146
+ ### 16.1 Slope Charts (Colon REQUIRED for data)
1385
1147
 
1386
- ### gantt
1148
+ ```
1149
+ slope Fleet Strength
1387
1150
 
1388
- **Syntax:** `gantt [Title]`
1151
+ 1715 1725
1389
1152
 
1390
- **Options:** `start` (required, `YYYY-MM-DD`), `today-marker` (`on`/`off` or `YYYY-MM-DD`), `sort` (`time`/`group`/`tag`/`tag:GroupName`), `critical-path`, `dependencies`
1153
+ Blackbeard: 40 4
1154
+ Roberts: 12 52
1155
+ ```
1391
1156
 
1392
- **Data format:** `duration Task Name` tasks with optional dependency arrows
1157
+ - Period labels on their own line, commas optional
1158
+ - Data rows: `Label: value1 value2` — colon required, commas between values optional
1159
+ - Thousands commas supported in values
1393
1160
 
1394
- Minimal example:
1161
+ ### 16.2 Wordcloud
1395
1162
 
1396
1163
  ```
1397
- start 2024-01-01
1164
+ wordcloud Pirate Skills
1165
+ rotate none
1166
+ max 50
1167
+ size 14 80
1398
1168
 
1399
- 10bd Design
1400
- -> Implementation
1401
- 20bd Implementation
1402
- -> Testing
1403
- 5bd Testing
1169
+ swordsmanship 95
1170
+ navigation 88
1404
1171
  ```
1405
1172
 
1406
- Auto-detection: Gantt charts are auto-detected when duration patterns like `10bd Design` are present — `gantt` is optional.
1173
+ - Data: space-separated only (`word value`)
1174
+ - Options: `rotate none|mixed|angled`, `max N`, `size min max`
1407
1175
 
1408
- Full example:
1176
+ ### 16.3 Arc Diagrams
1409
1177
 
1410
1178
  ```
1411
- gantt Project Schedule
1412
- start 2024-01-01
1413
- today-marker on
1179
+ arc Pirate Alliances
1414
1180
 
1415
- tag Team alias t
1416
- Frontend(blue)
1417
- Backend(green)
1181
+ [Caribbean](red)
1182
+ Blackbeard -> Bonnet 8
1183
+ Blackbeard -> Vane 5
1418
1184
 
1419
- holidays
1420
- 2024-01-15: MLK Day
1421
- 2024-02-19: Presidents Day
1422
-
1423
- era 2024-01 -> 2024-03 Phase 1(blue)
1424
- marker 2024-02-15 Sprint Review(orange)
1425
-
1426
- [Design]
1427
- 5bd UX Research | t: Frontend
1428
- 10bd Wireframes | t: Frontend
1429
- -informs-> API Design
1430
-
1431
- [Engineering]
1432
- 15bd API Design | t: Backend
1433
- -> Frontend Build | offset: 2bd
1434
- 20bd Frontend Build | t: Frontend
1435
- 10bd Integration Testing
1185
+ order group
1436
1186
  ```
1437
1187
 
1438
- **Start date**: `start YYYY-MM-DD` (required) project start date for computing all task dates.
1439
-
1440
- **Tasks**: `<duration> <name>` — duration units: `bd` (business days), `d` (days), `w` (weeks), `m` (months), `q` (quarters), `y` (years), `h` (hours), `min` (minutes).
1188
+ - Link: `Source -> Target weight` — space before optional weight
1189
+ - Options: `order appearance|name|group|degree`
1441
1190
 
1442
- **Explicit dates**: `YYYY-MM-DD Task Name` or `YYYY-MM-DD -> 30d Task Name` (date with duration).
1191
+ ### 16.4 Venn Diagrams
1443
1192
 
1444
- **Uncertain end**: Append `?` to duration (e.g., `10bd? Task`) — renders with a fading tail.
1445
-
1446
- **Dependencies**: `-label-> Target` or `-> Target` — indented under the source task. The target task starts after the source completes.
1447
-
1448
- **Dependency offsets**: `-> Target | offset: 2bd` — positive offset adds a gap; `-> Target | offset: -3d` — negative offset creates overlap (lead time).
1449
-
1450
- **Labeled dependency arrows**: `-label-> Target` — the label text appears on the rendered arrow.
1451
-
1452
- **Groups**: `[Group Name]` wraps indented tasks in a collapsible section.
1453
-
1454
- **Group metadata cascading**: `[Group Name] | key: value` — pipe metadata cascades to all tasks in the group.
1455
-
1456
- **Eras**: `era YYYY-MM -> YYYY-MM Label(color)` — background shading bands.
1457
-
1458
- **Markers**: `marker YYYY-MM-DD Label(color)` — vertical milestone lines.
1459
-
1460
- **Holidays**: `holidays` block with `YYYY-MM-DD: Name` entries or `YYYY-MM-DD -> YYYY-MM-DD: Name` ranges. Holiday dates skip business-day counting.
1461
-
1462
- **Tag groups**: Same syntax as other diagrams — `tag Name alias x` with colored entries.
1193
+ ```
1194
+ venn Skill Overlap
1463
1195
 
1464
- ---
1196
+ Swordsmanship(red) alias sw
1197
+ Navigation(blue) alias nav
1198
+ Leadership(green) alias lead
1465
1199
 
1466
- ## Tag Groups
1200
+ sw + nav Sea Raiders
1201
+ sw + nav + lead Legendary Pirates
1202
+ ```
1467
1203
 
1468
- Define reusable metadata categories for sequence, org, kanban, C4, sitemap, infra, gantt, initiative-status, and timeline diagrams:
1204
+ - Set declaration: `Name(color) alias X`
1205
+ - Intersections: `Set1 + Set2 Label` — label follows the last set reference (no colon)
1469
1206
 
1470
- ```
1471
- tag Priority
1472
- Critical(red)
1473
- High(orange)
1474
- Medium(yellow)
1475
- Low(green) default
1207
+ ### 16.5 Quadrant Diagrams
1476
1208
 
1477
- tag Team alias t
1478
- Frontend(blue)
1479
- Backend(green)
1480
1209
  ```
1210
+ quadrant Crew Assessment
1211
+ x-label Low Skill, High Skill
1212
+ y-label Low Loyalty, High Loyalty
1481
1213
 
1482
- - `tag` keyword (case-insensitive)
1483
- - Optional `alias` for shorthand in metadata: `| t: Frontend`
1484
- - `default` keyword marks the fallback value
1485
- - Indented entries with `Value(color)`
1486
-
1487
- Assign to elements via pipe metadata: `Element Name | priority: High, t: Frontend`
1214
+ top-right Promote (green)
1215
+ top-left Train (yellow)
1216
+ bottom-left Maroon (red)
1217
+ bottom-right Watch Closely (purple)
1488
1218
 
1489
- ---
1219
+ Quartermaster 0.9, 0.95
1220
+ Navigator 0.85, 0.8
1221
+ ```
1490
1222
 
1491
- ## Anti-Patterns
1492
-
1493
- **Common mistakes to avoid:**
1494
-
1495
- - `# comment` — wrong. Use `// comment`
1496
- - `chart: bar` + `title: Revenue` — wrong. Use `bar Revenue` (single first line)
1497
- - `Label: value` in ECharts data — wrong. Use `Label value` (no colon)
1498
- - `async A -> B: msg` — wrong. Use `A ~msg~> B`
1499
- - `parallel else` — not supported. Use separate `parallel` blocks
1500
- - Hex colors `#ff0000` — wrong. Use named colors only: `red`, `green`, `blue`, etc.
1501
- - `->` inside labeled arrows `A -routes to /api-> B` — ambiguous. Rephrase the label
1502
- - Missing chart type for ambiguous content — when auto-detection picks the wrong type, add an explicit chart type keyword
1503
- - `end` keyword in sequence blocks — not needed. Indentation closes blocks
1504
- - `== Column ==` in kanban — removed. Use `[Column]`
1505
- - `person Name` in C4 — removed. Use `Name is a person`
1506
- - `A <-> B` bidirectional arrows — removed. Use two separate lines
1507
- - `-> Target x5` fan-out — removed. Use `-> Target | fanout: 5`
1508
- - `lag: 5d` / `lead: 3d` in gantt — removed. Use `offset: 5d` / `offset: -3d`
1509
- - `Name(color)` in sequence participants — removed. Use `tag` groups for coloring
1223
+ - Axis labels: `x-label Low, High` — space-separated
1224
+ - Position labels: `top-right Label` — space-separated
1225
+ - Data points: `Label x, y` — space-separated, comma between coordinates
1226
+ - Thousands commas supported in values
1510
1227
 
1511
1228
  ---
1512
1229
 
1513
- ## CLI Usage
1514
-
1515
- ```bash
1516
- dgmo diagram.dgmo # PNG output (default)
1517
- dgmo diagram.dgmo -o output.svg # SVG output
1518
- dgmo diagram.dgmo -o url # Shareable URL
1519
- dgmo diagram.dgmo --palette catppuccin --theme dark
1520
- dgmo diagram.dgmo -o output.png --palette bold
1521
- ```
1230
+ ## 17. Colon Usage Summary
1231
+
1232
+ ### Constructs Where Colons Are REQUIRED
1233
+
1234
+ | Construct | Diagram Type | Example |
1235
+ |-----------|-------------|---------|
1236
+ | Pipe metadata | all | `\| key: value, key2: value2` |
1237
+ | Org metadata (indented) | org | `role: Manager` |
1238
+ | C4 metadata (indented) | c4 | `description: SPA built with React` |
1239
+ | Class field types | class | `+ name: string` |
1240
+ | Class method returns | class | `+ sail(): void` |
1241
+ | Function expressions | function | `f(x): x^2 + 1` |
1242
+ | Slope data rows | slope | `Blackbeard: 40 4` |
1243
+ | Hide tag values | initiative-status | `hide phase:Planning` |
1244
+
1245
+ ### Colons OPTIONAL
1246
+
1247
+ | Construct | Diagram Type | Example |
1248
+ |-----------|-------------|---------|
1249
+ | Class relationship label | class | `--|> Vessel : extends` or `--|> Vessel extends` |
1250
+
1251
+ ### Colons NOT USED
1252
+
1253
+ | Construct | Diagram Type | Example |
1254
+ |-----------|-------------|---------|
1255
+ | Chart type declaration | all | `bar Title` |
1256
+ | Tag declarations | all | `tag Name alias x` |
1257
+ | Boolean options | all | `activations`, `no-activations` |
1258
+ | Key-value options | all | `start 2026-03-15`, `active-tag Team` |
1259
+ | Series declarations | data charts | `series A B C` |
1260
+ | Data rows | bar/line/pie/etc | `Label 100` |
1261
+ | Infra node properties | infra | `latency-ms 50` |
1262
+ | ER columns | er | `id int pk` |
1263
+ | Sequence messages | sequence | `A -msg-> B` |
1264
+ | Groups/containers | all | `[Group Name]` |
1265
+ | Section dividers | sequence | `== Phase ==` |
1266
+ | Comments | all | `// comment` |
1267
+ | Wordcloud data | wordcloud | `swordsmanship 95` |
1268
+ | Venn intersections | venn | `sw + nav Sea Raiders` |
1269
+
1270
+ ### The Rule
1271
+
1272
+ **Colons appear in two contexts:**
1273
+ 1. **Value assignment** — `key: value` in pipe metadata, indented tag/metadata assignment (org, c4), and hide directives
1274
+ 2. **Type/expression separation** — where labels can contain spaces and a delimiter is needed (function expressions, slope data, class members)
1275
+
1276
+ **Exception**: Known-schema properties (infra node properties, ER columns) remain space-separated even though they are indented. The colon rule applies to open-ended metadata, not fixed property schemas.
1277
+
1278
+ **Colons never appear in:**
1279
+ - Directives and options (space-separated)
1280
+ - Tag declarations
1281
+ - Chart type declarations
1282
+ - Data rows for simple charts (space or comma delimited)
1283
+ - Structural syntax (groups, sections, arrows, comments)