Skip to main content

Module syntax

Module syntax 

Expand description

The toolkit’s grammar-backed Highlighter: Sublime syntax definitions run through syntect, used purely as a tokenizer. Each span’s scope stack (source.rust → meta.function → entity.name.function) maps to one TokenKind; colours stay with the renderer and the OS Theme, never with a syntect colour theme.

One process-wide SyntaxSet backs every caller: the extended set curated by the bat project (the defaults plus TOML, TypeScript, Dockerfile and more). It is the same packed set Typst loads for raw blocks, so a runtime carrying both stores those bytes once.

Structs§

SyntaxHighlighter
A grammar-backed Highlighter for one language.
SyntaxState
A grammar’s parse position between two lines: everything multi-line constructs (block comments, strings, heredocs) need to continue.