What is Diya?
Diagram it yourself, then adjust.
Diya is a language for diagrams. You write what you see as a grid of text, the sketch, and then refine it step by step: relations say what layout must hold, and styles say how things look. Each step renders, so you always have a picture to adjust.
Mercury
A B C D
--- relations
stack [A..D] {gap=50}
stack [Mercury A] {gap=30}
box#highlight [Mercury A] {padding=10}
--- styles
A..D: circle r=20 fill=#dbeafe ::text hidden
#highlight: stroke=black rx=10
A file has up to four sections
A Diya file is plain text. The sketch comes first, with no header; the other sections follow under separator lines, in any order:
| Section | Holds | Example |
|---|---|---|
| the sketch | what appears, and roughly where: one row per line, one cell per token | A B C D |
--- relations | layout that must hold, and connectors | stack [A..D] {gap=50} |
--- styles | how things look, with SVG's shapes and attribute names | A..D: circle r=20 |
--- config | settings for the whole diagram | row-gap=24 |
A sketch alone is a valid diagram. // starts a comment in every section, and an indented line continues the statement above it.
What it's built on
- No diagram types. There's no "flowchart" or "sequence" mode: the same sketch, relations and styles draw all of them. See the examples.
- The sketch is soft, relations are hard. The sketch places everything by default. A relation that places a token takes that axis over; the rest stays where the sketch put it.
- Errors, not guesses. A reference that matches several tokens, or two relations placing the same axis, is an error that says how to fix it. Diya never picks one silently.
- SVG's names. Shapes and attributes are a subset of SVG (
circle,fill,stroke-dasharray), so anyone who knows SVG can read them. Only what SVG doesn't have, such as layout, uses Diya's own names.
Next: get started, or read the guide, starting with the sketch.