d2 Cheat Sheet
d2 Cheat Sheet
shape: class
# labels on nodes
+prevRune: rune
- for private
}
# for protected
## tables
# chained connections
board: {
aws: {
id: int {constraint: primary_key}
server
}
}
board.diagram -> diagrams.id
aws: {
# markdown and code
server
points This will create - Usually, when you give shapes a value, they’re treated as labels, e.g. `a: b`
to this a new shape - However, you can also give it a Markdown-style block syntax, or define a
# Header
- Will be Markdown
pro tip: some keywords are reserved, for D2 renders this as Markdown text with no border.
example “label” and “shape.” You can
choose from any of these shapes:
## code
hexagon: {shape: hexagon}
etc. choose any shape in the shapes panel D2 renders this as a code block