Wit

Cheatsheet

Every everyday form at a glance. Each snippet is a verified one-liner — copy, paste, adapt. For depth, follow the links at the foot.

Call forms

@name                          bare reference
@namename@                  named body (block or inline)
@name(k v, k2 v2)              parens
@name(k: "a b")                colon key, quoted multi-word value
@name |k v|name@            pipes
@name { k - v }                record-arg
@name                          form-fill (then key: value ×2, then name@)
key: value
key2: value2
name@
@name k:v k2:v2 name@          colon-scatter
@node(type X …)                opaque pass-through
@@raw … raw@@                  raw literal ({{path}} still expands)
@@@frozen … frozen@@@          frozen literal (nothing expands)

Definitions

#name: value                   single-line def
#name:                         value-block def
…
!!
#namename#                  block def (… is the body slot)
#name ||a, b||                 capture list
+#name:                        additive partial
#rec: { k - v }                record data-def (hyphen delimiter)
#list: [ a, b ]                collection data-def

Inside a def

::capture::                    capture interpolation
...                            body slot
{{path}}                       raw-body hole (only inside @@@@)

Data and access

@rec.field                     field access (fuzzy: camel/snake/spaces)
42   true   null               scalar values
~ index access @list.0 currently renders unresolved — use (each)

Control flow

(if @path) … (else) … (end)    existence
(if @x is Y)(end)           comparison — identity
(if @x equals Y)(end)       comparison
(each @list as item)(end)   iterate — reference the element as @item

Inline

*bold*        → <strong>       marks wrap a token
_italic_      → <em>
@code x code@                  inline code (escapes its body)
@a |href …|a@               link
\*                             escape a literal special char

Media and layout

@img |src …| |alt …| |size medium| |align center|
@figurefigure@
@row @col |size 220|col@ @colcol@ row@

Tables

@table |rows [[H, …], [r, …]]| table@      inline CSV (row 0 = header)
@table |schema [k1, k2]| |rows @ref|       schema-as-array
@table |schema { k - Label }| |rows @ref|  schema-as-record
@table |rows @ref|                         rows-by-ref (auto columns)
|caption …|                                add a caption
|header false|   |header N|   |header [a, b]|

External data

@load env load@@env.HOME
@load alias |as name| |key v| load@

Comments

~ line comment                 (blank line after one inside a container)

CLI

wit parse <file>
wit check <file>
wit fmt <file> -w
wit build <file> -o out.html|out.md|out.pdf [--format …]
wit build <file> --fragment | --raw
wit build <file> --sources wit.sources.json --allow-exec --env .env
wit tour <file>

Core vocabulary — 52 names

headings    h1 h2 h3 h4 h5 h6
marks       em strong code u s sub sup mark small br
lists       ul ol li dl dt dd
links/media a img figure figcaption audio video
tables      table thead tbody tfoot tr th td caption
blocks      p blockquote pre hr
sectioning  section article aside header footer nav main
generic     div span
layout      row col
cite        cite

See also

Syntax

· Core vocabulary · Tables · CLI · Glossary.