Syntax
A .skemo file is a valid Pug document that uses a handful of tags and
lines written | text. Each line is one element; indentation says what contains what; the text of lines follows
Markdown.
//- A comment: not rendered
diagram(dir="down")
card#fw.t0(tag="Edge") Firewall
| 10.0.0.1/24
to(core).dashed transit
zone#lan.lan Internal LAN
card#core.t1 Core switch
| (stack of two)Tags and lines
| Write | Role | Content |
|---|---|---|
diagram(…) | optional first line: global options | everything else, indented below |
card#id.type | a card | text = title · | … = content lines · to(…) = arrows leaving it |
zone#id.type | a group | text = title · | … = description lines · indented cards and zones |
to(target).type | an arrow, inside its source card or zone | text = label (optional) |
| text | a line of the card, zone or title above it | Markdown emphasis; a line ending with | is a table row |
title, cards and stack complete the set: see Cards and zones.
Classes stick to the symbol that opens: |.warn text gives a line the class warn; | .env
(a space first) is the text “.env”.
Anatomy of a line
card#fw.t0.critical(tag="Edge" at="40,120") Perimeter firewall @2:up
│ │ │ │ │ └ animation marker (optional)
│ │ │ │ └ text: the title
│ │ │ └ attributes: one group, in parentheses
│ │ └ classes: the card's types, styled in CSS (several allowed)
│ └ id: unique, used as an arrow target
└ tag
- Id:
#followed by letters, digits,_or-. Every card or zone that an arrow targets needs one, and ids are unique in the file. - Classes:
.name, as many as you like. They are CSS classes: see Styling. - Attributes:
name="value", separated by spaces or commas. A bare name is an arrow target into(a b). Values take double or single quotes; numbers may go without. - Text: everything after the first space that follows the tag.
One attribute group per tag
Attributes go in a single pair of parentheses, right after the id or the classes:
to(core side="right-top").dashed ✓
to(core).dashed(side="right-top") ✗ error: several attribute groups
Indentation
Nesting follows indentation. Use 2 spaces (recommended) or tabs, but never both in one file. A zone contains cards and zones;
a card contains only lines | and to(…) arrows.
Comments
//- a comment, not rendered (its indented block is ignored too)
// also a comment
Older spellings
Files written before the language took its current form still open: li text is read as | text,
from/to on diagram as start/end, step=/fx=
as @ markers. skemo lint --fix rewrites them.
Formatting
skemo lint --fix file.skemo rewrites a file in canonical form (indentation, attribute order, markers);
skemo lint --fix --dry only reports whether it is formatted. Comments and the order of elements are kept.
File extension
.skemo. The content stays valid Pug, so an editor can use its Pug highlighting.
