Rich cards, tables and panels (preview)
A card can say what it is, stress a word, carry a table or a finding; a diagram can have a legend, a footnote and
panels set around the drawing. None of it needs a new tag: lines |, Markdown, classes and at=.
Category, emphasis and states
diagram(dir="right" lang="en")
card#api.service(label="ECS service (Fargate)" tag="module.app") api
| `python3.12` · autoscaling **2–12**
| logs kept *30 days*
to(db) 5432
card#db.store.warn(label="RDS PostgreSQL 16.4" tag="module.data") orders
| db.r6g.large · Multi-AZ
|.warn single-AZ replica
| backups: ==none==.service { --c: #3E6FC4; }
.store { --c: #B45309; }| Write | Effect |
|---|---|
label="RDS PostgreSQL 16.4" | the card's category, a small line above its name; by default the type's
--label; label="" shows none. tag= stays the chip on the right |
**bold**, *italic*, `mono` | Markdown emphasis inside a line or a table cell |
==text==, ==.ok text== | a mark: in red, or the colour of the line's state, or of the class
written after == |
.ok, .warn, .error | on a card: a ring and a mark before the name; on a line
(|.warn …): a mark and the state's colour; on a cell: the state's colour |
Delimiters only count when they wrap a word: cron(0 2 * * ? *) and status == 200 stay as written, and
_ is never emphasis. Write \*, \` or \== for the characters themselves.
Tables
diagram(lang="en")
card#sg(label="Security groups") Ingress
| All groups allow all egress.
| Group | Inbound | Attached to |
|--------|----------------------------|---------------|
| alb | 443, 80 from ==0.0.0.0/0== | load balancer |
| api | 8080 from alb | ECS api tasks |
| ^^ | 9090 from monitoring | ECS api tasks |
| worker | no inbound rule ||
|.error lambda | none | order_events |A table is written as a Markdown table inside a card: a line that ends with | is a row, rows that follow each other
are one table, and the card can hold lines of text before and after it. The spaces around a cell are trimmed, so a table aligned by
any Markdown formatter stays valid.
| Write | Effect |
|---|---|
|---|---| after the first row | the first row is a header; :---: centres a column, ---: aligns it right |
|| (nothing in the cell) | the cell on the left spans this column too; an empty cell is | | |
^^ | the cell above spans this row too |
|.error lambda | | the cell takes the class (glued to the bar) |
| alone | an empty line; it also separates two tables |
A table never wraps: its card grows as wide as it needs. Arrows end on the card, not on a row.
Legends and plain text
diagram(dir="right" lang="en")
card#web.service Web
to(api).user HTTPS
card#api.service API
to(queue).events jobs
card#queue.store Queue
card#flows.legend Flows
|.user user request
|.events events / queues
|.warn finding worth reviewing
card#auto.legend Automatic.service { --c: #3E6FC4; --label: "Service"; }
.store { --c: #B45309; --label: "Data store"; }
.edge.user { color: #3E6FC4; --label: "user request"; }
.edge.events { color: #D97706; --label: "events"; }
.edge.events .line { stroke-dasharray: 5 4; }card.legend is a legend: each line |.class text shows a sample of the class it names, an arrow for a
class used on arrows, a chip for a card type, a small frame for a zone type, the icon of a class that sets
--icon, the mark for a state. A legend without lines lists by itself the classes of the
diagram that have a --label in the stylesheet (arrow classes too: .edge.events { --label: "events"; }).
card.text is plain text with no frame, for a note or a footnote.
Panels, legends and footnotes around the drawing
diagram(dir="right" lang="en")
title Shop platform
| Production · eu-west-3 · 106 resources
|.pill prod
card#users Customers
to(alb) HTTPS
zone#vpc.net VPC 10.20.0.0/16
| 3 availability zones
card#alb(label="Load balancer") shop-prod
to(api) :8080
card#api(label="ECS service") api
zone#sec(at="s") Security
card#kms(label="KMS key") alias/shop
| encrypts RDS, SQS, S3
zone#ops(at="s") Monitoring
card#alarms(label="CloudWatch") 3 alarms
to(sns)
card#sns(label="SNS topic") alerts
card#key.legend(at="ne") Key
|.net network
card.text.wide(at="s")
| Omitted for clarity: route tables, IAM policy attachments..net { --c: #0F766E; }at= with a compass point docks a top-level card or zone outside the drawing, which is laid out as if it
were absent: nothing in it moves.
| Write | Where |
|---|---|
at="s", at="n" | a band below (above) the drawing, over the whole width; several elements go side by side
in writing order; a .wide one takes a row of its own (a footnote: card.text.wide(at="s")) |
at="e", at="w" | a column on the right (left) of the drawing |
at="ne", at="nw", at="se", at="sw" | in that column, at the top or the bottom: a legend at the top right is at="ne" |
A docked zone is laid out on its own, like a small diagram. An arrow between a docked element and the rest of the drawing is
not drawn (warning docked-arrow).
Subtitle and zone descriptions
Lines | under title are subtitle lines; |.pill lines are pills on the title's row. Lines
under a zone are a description under its title (“3 availability zones”); the zone keeps room for them.
