The spec
The normative description of Wit 0.3 is docs/spec.md in the
repository. It is also a test suite: every example in it is built and compared
with its expected output on every test run.
How it is checked
- Each
witexample followed by anhtml expected,md expectedortext expected-errorblock is run bytests/runner/spec.test.ts. An error block names a code, optionally withat L:C. - Edge cases that would clutter the text live in
tests/spec/ascase.witpluscase.expected.html,.expected.mdor.expected-error; a folder withmain.witis a multi-file case. tests/spec/pending.txtlists cases not implemented yet. They must still fail; one that starts passing fails the run until its line is deleted.- Expected HTML is compared without the
<article class="wit-doc">wrapper, ignoring whitespace between tags and just inside block tags.
The run prints N of M cases pass.
What it covers
Lexical structure, the prose layer, nodes and parameters, the parenthesis form, closing rules, definitions and headers, records, collections, data access, conditionals, iteration, scripting, composition, the core vocabulary, tables, scalars, the removed 0.2 forms, the error-code table, the AST kinds and the CLI.
Where to look
| Question | Look in |
|---|---|
| what the language means | docs/spec.md |
| one edge case | tests/spec/ |
| every page renders as before | tests/rendered/ snapshots |
| AST types | packages/parser/src/ast.ts |
| an error code | packages/parser/src/errors.ts and packages/runtime/src/errors.ts |
These docs follow the spec. Where a page and the spec disagree, the spec wins — please report the page.
Adding to it
Write the spec case first, add it to pending.txt, implement, then
delete the pending line. See Extending.