Core vocabulary
The 52 names that need no definition, with the HTML each emits and the
parameters it reads. Each one-line use below works in either form — @em x em@ or (em x em). Also here: the opaque @node and the raw nodes.
Headings — 6
h1 … h6 emit the same tag with id / class. A one-line heading holds no <p>.
(h1 Title h1) @h2(id: methods) Methods h2@
Title
Methods
<h1>Title</h1><h2 id="methods">Methods</h2>
Inline — 12
| Node | Emits |
|---|---|
| em | em |
| strong | strong |
| code | code — body escaped |
| u | u |
| s | s |
| sub | sub |
| sup | sup |
| mark | mark |
| small | small |
| span | span |
| cite | cite |
| br | br — void |
(strong Bold strong), (code x < y code), H@sub 2 sub@O, 12 km@sup 2 sup@ and line one@br line two.
Bold, x < y, H2O, 12 km2 and
line one
line two.
<p><strong>Bold</strong>, <code>x < y</code>, H<sub>2</sub>O, 12 km<sup>2</sup> and line one<br> line two.</p>
em and strong are the explicit form of _x_ and *x*. A known node may follow a word
directly when not followed by ., so emails stay prose. code escapes its body but still reads Wit inside; for verbatim
text use @@code … code@@.
Lists — 6
ul, ol, li, dl, dt, dd — same tag, id / class.
@ul (li First li) (li Second li) ul@ @dl (dt Term dt) (dd Definition dd) dl@
- First
- Second
- Term
- Definition
For data-driven lists, loop a collection — see data model.
Links and media — 6
| Node | Parameters | Notes |
|---|---|---|
| a | href and target plus id and class | href is literal; no href renders as # |
| img | src and alt and width and height and size and align | void; src is literal |
| figure | size and align | align sets text-align on image and caption |
| figcaption | id and class | — |
| audio | src and controls | controls: true is a flag; false is off |
| video | src and controls | the body renders inside as fallback |
(a(href: https://en.wikipedia.org/wiki/Mercury_(planet), target: _blank) Mercury a) @img(src: p.jpg, alt: A lamp, size: medium, align: center) @figure(align: center) @img(src: p.jpg, alt: A lamp) (figcaption The lamp, 1923. figcaption) figure@ @audio(src: clip.mp3, controls: true) audio@
<p><a href="https://en.wikipedia.org/wiki/Mercury_(planet)" target="_blank">Mercury</a></p> <img src="p.jpg" alt="A lamp" style="max-width:380px;height:auto;display:block;margin-left:auto;margin-right:auto"> <figure style="text-align:center"><img src="p.jpg" alt="A lamp"><figcaption>The lamp, 1923.</figcaption></figure> <audio src="clip.mp3" controls></audio>
| Value | Compiles to |
|---|---|
| small | max-width:220px |
| medium | max-width:380px |
| large | max-width:600px |
| a bare number N or Npx | max-width:Npx |
| full | width:100% |
| a percent | width:N% |
Presets and pixel values cap the width and never upscale; full and percents fill. align: center centres the block; left / right push it to that side.
Tables — 8
table has its own renderer; thead, tbody, tfoot, tr, th, td and caption build one by
hand, and their cells may hold any inline Wit.
| Parameter | Meaning |
|---|---|
| rows | a collection of rows; row 0 is the header — or a reference to one |
| schema | a record that picks and labels columns of a list of records; or a list of keys |
| caption | a caption |
| header | false for no header row; a list to supply one |
#sites: [ { name: Dunmore Head, status: operational } { name: Carrick Point, status: maintenance } ] !! @table(caption: Hours, rows: [[Client, Total], [One to one, 104]]) @table(schema: { name: Site, status: Status }, rows: @sites) @table @thead @tr (th Term th) (th Meaning th) tr@ thead@ @tbody @tr (td (code x < y code) td) (td _anything_ inline td) tr@ tbody@ table@
| Client | Total |
|---|---|
| One to one | 104 |
| Site | Status |
|---|---|
| Dunmore Head | operational |
| Carrick Point | maintenance |
| Term | Meaning |
|---|---|
x < y | anything inline |
More in Tables.
Blocks — 5
p, blockquote, pre, div take id / class; hr is void. A block element on its own line ends the paragraph
before it.
@blockquote Interviewer: How was it? P12: Honestly, fine. blockquote@ @div(class: card) Body. div@ @hr
Interviewer: How was it? P12: Honestly, fine.
Body.
<blockquote><p>Interviewer: How was it? P12: Honestly, fine.</p></blockquote><div class="card"><p>Body.</p></div><hr>
pre escapes its body and keeps its lines; for text that must
not be read as Wit use @@pre … pre@@.
Sectioning — 7
section, article, aside, header, footer, nav, main — same tag, block, id / class. Opening one on its own line needs its close
(E_UNCLOSED_NODE).
@section(id: results) (h2 Results h2) The beam swept the harbour. section@
Results
The beam swept the harbour.
Layout — 2
row is an invisible flex band; each col is a
column. size fixes a column's width (small 220px, medium 380px, large 600px, a number, px or a
percent); a column without one fills. Columns stack when the row is narrow.
@row @col(size: 220) @img(src: p.jpg, alt: A lamp) col@ @col The lamp was lit at dusk. col@ row@
Opaque node
@node(type: x, …) passes every parameter to the renderer. When type is a core name it renders as that element; otherwise the
HTML renderer emits a div with each parameter as a data-* attribute. Any identifier is a key here.
@node(type: box, role: note) Hi. node@
Hi.
<div data-type="box" data-role="note"><p>Hi.</p></div>
Raw nodes
| Name | Emits |
|---|---|
| style | a style element — body verbatim |
| script | a script element — body verbatim |
| code | code — escaped |
| pre | pre — escaped and lines kept |
| math | inline MathML from AsciiMath |
| mathblock | block MathML |
| diagram | a pre with class wit-diagram mermaid |
@@name … name@@ keeps its body verbatim but fills {{path}} holes; @@@name … name@@@ fills nothing.
#theme: { accent: teal } !! @@style .lead { color: {{theme.accent}} } style@@ Area: @@math pi r^2 math@@.
Area: .
Unresolved output
| Input | Emits |
|---|---|
@name with no definition | E_UNRESOLVED_REFERENCE |
a missing field @a.b | <span class="wit-unresolved">@a.b</span> |
::name:: outside a definition | <span class="wit-unresolved">::name::</span> |
| a bare record or collection | <div class="wit-node" data-wit-name="name"></div> |
See also
Syntax · Tables · Images & media · Data model · Limitations.