Skip to main content

A user-supplied grammar

TOML is not one of Quarto’s built-in highlighting languages. This project adds it by shipping a tree-sitter grammar in _quarto/grammars/toml/: the compiled toml.wasm and its highlights.scm query. Any code block marked toml now picks it up:

# Site configuration
[server]
host = "localhost"
port = 8080
debug = false
started = 2026-11-05T09:30:00Z

[[server.routes]]
path = "/docs"
cache = { enabled = true, max-age = 3600 }

Inline code works the same way: retries = 3.

The grammar’s capture names become CSS classes: a capture @name.sub is emitted as <span class="hl-name-sub">. This grammar’s query captures TOML keys as @type, so the style block below sets .hl-type in bold; the colors come from the default palette.