docs/typ: the Typst documentation corpus style.typ every semantic function, the palette and the topic ids; the only place they are defined. Each function looks at target(): it draws itself for paged output and emits HTML elements under --features html. cheatsheet.typ content: facts as markup and the calls below, no layout. Later topics (guide, scripting, reference, building) go beside it as their own content files. cheatsheet-a4.typ output wrapper: the one-page A4 cheatsheet. book.typ output wrapper: an A4 book, title page, contents, every chapter, then the tutor (src/tutor.txt). html.typ output wrapper: one HTML page, every chapter under an anchor named by its id, then the tutor. Wrappers hold layout only, never facts. Chapters: `chapters` in style.typ lists them in reading order (guide, cheatsheet, scripting, reference, themes, building), each with its content file, or none while it is not written (the outputs show a placeholder). To add a topic, write docs/typ/.typ and set its `file`. Wrappers include it with heading offset 1, so its = headings sit under the chapter title, which is labelled ch-. Labels on headings must be unique across all the topics, since the book and the HTML hold them all. Build (from the repo root): typst compile --ignore-system-fonts docs/typ/cheatsheet-a4.typ zig build cheatsheet -Dplatform=tty --prefix DIR # DIR/share/doc/pardes/cheatsheet.pdf typst compile --root . --ignore-system-fonts docs/typ/book.typ typst compile --root . --features html --format html docs/typ/html.typ pardes.html (--root . because book and HTML read the tutor from src/tutor.txt.) The contract for content files ------------------------------ Start a content file with #import "style.typ": key, keys, btn, chord, word, tag, addr, file, cmd, doc, pairs (a content file does not import page setup; the same file goes into the book, the HTML and, for the cheatsheet, the A4 page) and use plain markup (= headings, - lists, `raw`, *strong*) plus these. Never set page, fonts, colours or spacing in a content file; ask for a new function instead. word(w) a builtin or tag word, drawn as it sits in a tag. #word("Save") #word("Tty+bash") key(k) one press, or a sequence of presses separated by spaces, drawn as one pill (Ctrl + w, g › g). Modifiers: Ctrl-, Alt-, Shift-. #key("Ctrl-w") #key("g g") #key("SPC f c") keys(..ks) alternatives listed together, each its own key. #keys("h", "j", "k", "l") #keys("g d", "g r") btn(b, shift:) a mouse button, B1 B2 (the wheel) or B3, drawn as a mouse with that part filled; shift: true adds a ⇧. #btn("B3") #btn("B1", shift: true) chord(..bs) a chord: the first button held, each next clicked. #chord("B2", "B1") #chord("B1", "B2", "B3") tag(words, path:) a whole default tagline; words must be a default tag. #tag("Save Tty Collapse Del", path: "/home/me/notes.txt") addr(a) a look address. #addr("file:12:5") file(p) a 9P path. #file("pane/N/addr") cmd(c) a shell line, as a block. #cmd("echo Save > $m/pane/$n/ctl") doc(id, section:) a pointer to a chapter, or a section of it by the label on its heading. Ids: guide cheatsheet scripting reference themes building (and the older tags fs config keys detached, mapped in `topics`). A link in the book and the HTML; on the A4 sheet, its name. #doc("building", section: "listeners") pairs(split:, ..cells) a two-column table, a thing and its meaning, rows on alternating tints; split: 2 sets it as two tables side by side on paper. Cells alternate left, right. #pairs(key("u"), [undo], keys("i", "a"), [insert]) The drift test -------------- The unit test "docs/typ names only words, keys and default tags that exist" (src/config.zig) reads every .typ here and fails when a word(), key(), keys() or tag() names a builtin, key binding or default tag that pardes no longer has. Pass these functions string literals, so the test can read them. Only embedded fonts (Libertinus Serif, DejaVu Sans Mono), so output is the same on every machine. docs/typ/cheatsheet-a4.pdf is committed, as the other docs PDFs are; re-render it when the content changes.