Skip to main content

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, --- styles and --- config start 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​

SyntaxMeaning
a lineA row, numbered from 1
a tokenA 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​

SyntaxMeaning
A, "Stage 1"A token, by text
@r3, @c2, @r3c2A row, a column, a cell
43@r3, •@c2Text narrowed to a row or column
Rethink@c-1, OK@r+1c-1A cell relative to a token
•@r2[3]The n-th match, from 1
A..DThe rectangle between two cells
[A B C]A list; in relations, a group
#nameOne relation, by id
.nameRelations, by class
::nameA 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 …}

VerbPropertiesWhat it does
stackgap (10)Spaces its targets, in the sketch's direction
boxpadding (10)A box around its targets
arrowextend (0), labelFrom the first target to the last; empty cells are waypoints
lineextend (0), labelAn arrow without heads; whole rows and columns span

Styles​

selector, selector…: [shape] attribute=value … [::part shape attribute=value …]

KindNames
Shapesrect, circle, ellipse, polygon, path, image
Shape attributesfill, stroke, stroke-width, stroke-dasharray, opacity, r, rx, ry, width, height, points, d, viewBox, href
Text attributesfill, font-size, font-weight, font-style, font-family, align, wrap, hidden
Connector attributesstroke, stroke-width, stroke-dasharray, opacity, curved, start, end
Layerz-index

Sizes are pixels (20 or 20px); width and height also take a percentage of the token's cells.

Config​

KeyDefault
padding10
row-gap12
column-gap20

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).