Cheatsheet
Wit 0.3 on one screen. Every block builds as written — copy, paste, adapt. Details: syntax reference.
Text and nodes
_italic_ *bold* \*literal\* ~~ hidden note ~~/ ~ a line comment (h2 A heading h2) A (em one-line em) use, a (a(href: /docs/) link a), and @strong the same strong@. Water is H@sub 2 sub@O. @img(src: lamp.png, alt: A lamp, size: medium, align: center) @section Multi-line containers take @@@code @name code@@@ … @@@code name@ code@@@. section@ (aside(class: note) 💡 A callout. aside)
Definitions
source
#year: 1923 !! #cite(author, year): ::author:: (::year::) !! #card(title) @section (h3 ::title:: h3) ::body:: section@ card# #sig — M. Finch sig# In @year, as @cite(Weil, 1952) argued. @card(title: Delta) The beam swept the harbour. card@ @card(title: Echo): A value-block use, closed by two bangs. !! @sig
result
In 1923, as Weil (1952) argued.
Delta
The beam swept the harbour.
Echo
A value-block use, closed by two bangs.
— M. Finch
Data and logic
source
#keeper: { name: Aldous Vane, years at post: 31, lamp lit: true } !! #themes: [ attention, perception, failure ] !! @keeper.name, @keeper.years_at_post years. First: @themes.0. (if @keeper.lamp_lit)Lit.(else)Dark.(end) (if @keeper.name is Aldous Vane)Known keeper.(end) @ol (each @themes as t) @li @t (@t.index of @t.count)(if @t.last) — final.(end) li@ (end) ol@
result
Aldous Vane, 31 years. First: attention.
Lit. Known keeper.
- attention (0 of 3)
- perception (1 of 3)
- failure (2 of 3) — final.
Lists, tables, entries
source
#sites: [ { name: Dunmore Head, status: operational } { name: Carrick Point, status: maintenance } ] !! @ul (li First li) (li Second li) ul@ @table(caption: Hours, rows: [[Client, Total], [One to one, 104]]) @table(schema: { name: Site, status: Status }, rows: @sites) @ol (each @refs as r) (li @r li) (end) ol@ +#refs: Weil, S. (1952). _Gravity and Grace_. !! +#refs: Berger, J. (1972). _Ways of Seeing_. !!
result
- First
- Second
| Client | Total |
|---|---|
| One to one | 104 |
| Site | Status |
|---|---|
| Dunmore Head | operational |
| Carrick Point | maintenance |
- Weil, S. (1952). Gravity and Grace.
- Berger, J. (1972). Ways of Seeing.
Raw, scripts, files
#theme: { accent: teal } !! @@style .lead { color: {{theme.accent}} } style@@ @@code x < y, {{theme.accent}} filled code@@ @@@code nothing {{expands}} here code@@@ Two plus two is <% 2 + 2 %>. @load(as: e) env load@ Built by @e.USER.
Pull in another file with reference ./chapters/one.wit on its own
line.
CLI
wit build doc.wit -o doc.html # also .md, .pdf wit build doc.wit --fragment # bare <article> wit check doc.wit other.wit # full dry run wit fmt doc.wit -w # or --check wit migrate docs/ -w # rewrite 0.2 sources wit tokens -e '(em x em)' # how a snippet lexes
Core names
headings h1 h2 h3 h4 h5 h6 inline em strong code u s sub sup mark small span cite 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 div sectioning section article aside header footer nav main layout row col
See also
Syntax · Core vocabulary · Errors · CLI.