Syntax
Every part of the language on one page. The guide explains each with examples.
File
- Plain text, extension
.diya, Markdown fence```diya. - Everything before the first separator is the sketch; a sketch alone is a diagram.
- Separators
--- relations,--- stylesand--- configstart sections, in any order. A repeated section continues the earlier one. //starts a comment, in every section, except inside quotes.- An indented line continues the statement above it (not in the sketch, where every line is a row).
Sketch
| Syntax | Meaning |
|---|---|
| a line | A row, numbered from 1 |
| a token | A cell; its text is drawn and names it |
"two words" | A token with spaces or symbols, or a literal ., ^, < |
. | An empty cell |
^ | This cell belongs to the token above |
< | This cell belongs to the token on the left |
References
| Syntax | Meaning |
|---|---|
A, "Stage 1" | A token, by text |
@r3, @c2, @r3c2 | A row, a column, a cell |
43@r3, •@c2 | Text narrowed to a row or column |
Rethink@c-1, OK@r+1c-1 | A cell relative to a token |
•@r2[3] | The n-th match, from 1 |
A..D | The rectangle between two cells |
[A B C] | A list; in relations, a group |
#name | One relation, by id |
.name | Relations, by class |
::name | A part of a token (styles; arrow ends) |
In relations, each reference must match exactly one cell; in styles, a selector applies to every match.
Relations
verb[#id][.class…] [group] [group]… {key=value …}
| Verb | Properties | What it does |
|---|---|---|
stack | gap (10) | Spaces its targets, in the sketch's direction |
box | padding (10) | A box around its targets |
arrow | extend (0), label | From the first target to the last; empty cells are waypoints |
line | extend (0), label | An arrow without heads; whole rows and columns span |
Styles
selector, selector…: [shape] attribute=value … [::part shape attribute=value …]
| Kind | Names |
|---|---|
| Shapes | rect, circle, ellipse, polygon, path, image |
| Shape attributes | fill, stroke, stroke-width, stroke-dasharray, opacity, r, rx, ry, width, height, points, d, viewBox, href |
| Text attributes | fill, font-size, font-weight, font-style, font-family, align, wrap, hidden |
| Connector attributes | stroke, stroke-width, stroke-dasharray, opacity, curved, start, end |
| Layer | z-index |
Sizes are pixels (20 or 20px); width and height also take a percentage of the token's cells.
Config
| Key | Default |
|---|---|
padding | 10 |
row-gap | 12 |
column-gap | 20 |
Not built yet
These are part of the design but throw an error saying they aren't implemented yet: the align relation, dx / dy nudges, width, height, layout-direction, fit and align in config (and as render options), and a file with no sketch (automatic layout).