Command line
skemo is a single executable. Rendering is its default command: skemo f.skemo writes
f.png.
Commands
| Command | Role |
|---|---|
skemo init [file] [--css [name]] | a sample diagram (diagram.skemo); with --css, a commented stylesheet it includes (skemo_style.css); overwrites nothing |
skemo f.skemo | same as skemo render f.skemo: writes f.png next to the source |
skemo render f.skemo -o out.ext | the extension picks the format: png svg
webp html gif apng |
skemo lint f.skemo… | diagnostics only (exit code 1 on errors); --contrast adds the
legibility check |
skemo lint --fix f.skemo… [--dry] | canonical formatting |
skemo f.skemo --watch | live preview on http://127.0.0.1:8710, reloaded on every save |
skemo layout f.skemo --json | model, positions and routes as JSON |
skemo lint f.skemo --fit [16:9] [--fix] | settings (dir, wrap) that
bring the diagram to a target aspect ratio; --fix applies the best one (preview) |
skemo extract image.png [-o folder] | gives back the source and stylesheets embedded in an
image rendered by skemo, to edit them (--stdout: the source only); two stylesheets of the same name come back as
skemo.css and skemo-2.css |
skemo site folder -o out | a website from a folder of diagrams: a card linked to another
.skemo (href="shop/api.skemo") opens its page on a click; breadcrumb, list of the diagrams, pan
and zoom (preview, see below) |
skemo icons [query] | the built-in icons, filtered by name or tag; --json for editors and completion (not listed in --help) |
Render options
| Option | Effect |
|---|---|
-o FILE | output file; - = standard output (with --format) |
--format FMT | html svg png gif apng
webp, when the extension is not enough |
--css FILE | custom stylesheet, after the theme (repeatable) |
--base-theme FILE | a theme that replaces the default one |
--theme T | light dark print auto, overriding the file (auto follows the
reader in HTML only; other formats are drawn light, with a warning) |
--scale N | resolution of raster outputs (--scale 2 for high-density screens) |
--transparent | no background (SVG, PNG, APNG) |
--contrast high | texts below the WCAG threshold are darkened or lightened, layout unchanged |
--step N | render one animation state |
--animated, --board | one PNG per state, or a contact sheet of the states |
--hold, --transition, --fps, --final-hold, --no-loop |
timing of GIF and APNG |
--motion | SVG: play the .pulse and .flow arrows (Animated flows) |
--no-fonts | HTML: do not embed the fonts (much smaller file) |
--embed-fonts | SVG: embed the fonts used, for viewers without Inter (about 0.8 MB per weight) |
--font-scale K | multiply every text size of the theme (1.4 for a slide) |
--no-source | do not embed the source and stylesheets in the output (below) |
--deny-warnings | fail on any warning (useful in CI) |
--allow CODE | leave out the warnings of that code: not shown, not counted by --deny-warnings (--allow step-gap,overlap) |
The input - reads standard input:
cat f.skemo | skemo render - --format svg -o - > f.svg.
Running skemo from a tool
For a program that runs skemo (a slide tool, a CI, an editor), the command line is a stable contract (cli/SPEC.md §2):
| Option | Effect |
|---|---|
| exit codes | 0 rendered, 1 the diagram is refused (nothing on the standard output),
2 misuse, 3 internal error |
--diagnostics json | one JSON object per line on the standard error: severity, stable code, message, file, line and column |
--root DIR | the images and stylesheets the diagram names are read in this folder only (default: the diagram's) |
skemo render --batch | many diagrams in one process: one JSON request per line in, one answer per line out |
skemo capabilities --format json | version, version of the SVG conventions, features |
Images that reopen
Like draw.io, every file skemo renders carries its source and its stylesheets (PNG, APNG, SVG, WebP, GIF and HTML), in metadata that viewers ignore. The image can be shared alone and edited later:
skemo extract diagram.png # writes diagram.skemo and its stylesheets next to the image
skemo render diagram.png -o new.svg # any command also takes the image instead of the source
The editor opens such an image directly. The embedded text is readable by anyone who gets the file: render with
--no-source when the source must not travel with the image.
A website of linked views
A system too large for one drawing reads better as several views: the context, then the containers of one part, then the components of one container. Link a card to the diagram that details it, then turn the folder into a site:
card#api.app(href="api.skemo") API # in shop/containers.skemo
card#db.store(href="containers.skemo#db") DB # back up, centred on the element
skemo site architecture/ -o public/ --css architecture/c4.css
Each .skemo becomes a page at the same place (shop/api.html). A link to a diagram shows a magnifier
instead of the link glyph; a click zooms into the card and opens its page. index.skemo is the home page (without one,
the home page shows a thumbnail of each diagram); the breadcrumb follows the shortest way down from it. A link to a missing
diagram is a warning (site-missing-diagram); one refused diagram refuses the site. --css gives a style
to every diagram; the pages follow the reader's light or dark system, with a switch (--theme light draws one
theme only); the side panel's edge sets its width; --title names the site. The
search box at the top (/) finds a card in every diagram, by its title, category, tag, zone or lines, and opens its
page centred on it. The pages need no server and no network.
Exit codes
0 | success |
1 | errors in the file |
2 | wrong usage |
3 | internal error |
Shell completion
skemo completions bash (or zsh, fish, elvish, powershell) prints a
completion script; it is not listed in --help. Load it from your shell's startup file:
eval "$(skemo completions bash)" # ~/.bashrc
source <(skemo completions zsh) # ~/.zshrc
Language
Help, diagnostics and messages follow the system language (LANG, LC_ALL… as usual; English and French
today). SKEMO_LANG=fr overrides it. Labels the engine draws (months, centuries) follow it
too, unless the diagram pins them with diagram(lang="en").
Determinism
Fonts and theme are embedded: the same file gives the same image on every machine, which makes rendered files safe to commit and
compare. watch only listens on 127.0.0.1.
