Menu

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.

{"skemo":1,"name":"syntax.skemo","source":"//- A comment: not rendered\ndiagram(dir=\"down\")\n\n card#fw.t0(tag=\"Edge\") Firewall\n | 10.0.0.1/24\n to(core).dashed transit\n\n zone#lan.lan Internal LAN\n card#core.t1 Core switch\n | (stack of two)\n","theme":"light"}T0FirewallEdge10.0.0.1/24INTERNAL LANT1Core switch(stack of two)transit
{"skemo":1,"name":"syntax.skemo","source":"//- A comment: not rendered\ndiagram(dir=\"down\")\n\n card#fw.t0(tag=\"Edge\") Firewall\n | 10.0.0.1/24\n to(core).dashed transit\n\n zone#lan.lan Internal LAN\n card#core.t1 Core switch\n | (stack of two)\n","theme":"dark"}T0FirewallEdge10.0.0.1/24INTERNAL LANT1Core switch(stack of two)transit
syntax.skemo
//- 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

WriteRoleContent
diagram(…)optional first line: global optionseverything else, indented below
card#id.typea cardtext = title · | … = content lines · to(…) = arrows leaving it
zone#id.typea grouptext = title · | … = description lines · indented cards and zones
to(target).typean arrow, inside its source card or zonetext = label (optional)
| texta line of the card, zone or title above itMarkdown 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 in to(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.