Wit

Escapes & special characters

A backslash keeps a literal character where Wit would otherwise read syntax — a colon that should not lift a parameter, a brace that should not open a record, a comma inside a value. And quoting is the companion tool: it is how you carry spaces, commas, and newlines through a value untouched. The recognised set depends on context, so this page is organised by where you are writing.

Why escapes exist

Wit reads certain punctuation as structure — : lifts a colon-scatter parameter, { opens a record, , separates fields. When you want the character itself, escape it; when a value carries whitespace, quote it.

The escape set by context

  • Prose text recognises \@, \#, \*, \_, \~, and \| — the six characters that lead a structural reader (a node or definition opener, an emphasis mark, a line comment, a parameter pipe). The backslash is dropped and the character stays literal, so \@handle renders a plain @handle and \*star\* keeps its asterisks. Any other character is already literal in prose, so it needs no escape.
  • Pipe values recognise \|, which carries a literal pipe through the value (|href a\|b| yields a|b).
  • Colon-scatter uses \: as the opt-out: it suppresses the lift and the backslash is stripped from the output .
  • Quoted strings (in records and parameters) recognise only \" and \\.
  • Form-fill values carry text through as-is. The inline parser does not run on them, so emphasis markers like _ and * are already literal — no escape needed or consumed.

Quoting is the whitespace tool

For a value that contains spaces, commas, or newlines, prefer a quoted string over escaping each character:

#cite: { author: "Boud, D.", year: 2024 }
@thing mode:"complex value" thing@

The quotes protect the comma and the space and force a string type.

The delimiter hole in parens

There is one honest gap: parens have no escape for their own delimiters. A literal , or ) inside a parens value cannot be escaped away. Pipes do not share this gap — a pipe value escapes its own delimiter with \| — so when you need a comma or a close-paren in a value, switch to a pipe, or to a body form (form-fill or record-arg) that supports quoting.

The colon-scatter sharp edge

Because the scatter contract is strict, a stray in prose lifts a parameter you did not intend:

@thing the variable name:Tauraj is bad thing@
name

is lifted. Fix it with the escape — name:Tauraj — or a space — name: Tauraj.

Common mistakes

  • Reaching for \_ or \* in a form-fill value — the marker is already literal there, so the backslash just adds a stray character. (In prose those escapes are real and do strip.)
  • Expecting a paren delimiter to be escapable — rephrase, switch to a pipe, or use a body form.
  • Forgetting that quotes force a string type.

See also

Colon-scatter

· Form-fill · Data (quoting) · Record-arg · Type-classified scalars · Gotchas