Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Upgrading

From 3.x and 2.x

4.0 removes what 2.x and 3.x had deprecated and reports what it no longer understands.

  • library and symbol are removed. A language that still sets either fails the build with unknown field `library` , and so does any other setting a language table does not know. For a language from the built-in list, remove them along with the highlights path: the grammar and its queries are fetched instead. Any other grammar is named by git, its repository URL or a path to a local checkout.
  • A copy of the bundled stylesheet in additional-css is no longer reported. The stylesheet is embedded, so remove the copy, or keep only your own changes in it. A copy that replaces the bundled theme belongs in theme/highlight_ts.css.
  • The library API changes. LanguageConfig loses library and symbol, gains lsp, and rejects unknown keys. Config and LanguageConfig are now #[non_exhaustive], so code that builds one with a struct literal must be updated, once: later options are minor releases. The libloading and tree-sitter-language dependencies are gone.

A 3.x or 2.x configuration such as

[preprocessor.tsitter.languages.rust]
library = "parsers/rust.so"
highlights = "queries/rust/highlights.scm"

[preprocessor.tsitter.languages.mylang]
library = "parsers/mylang.so"
highlights = "queries/mylang/highlights.scm"

[output.html]
additional-css = ["theme/treesitter.css"]

becomes

[preprocessor.tsitter.languages]
rust = {}

[preprocessor.tsitter.languages.mylang]
git = "https://github.com/someone/tree-sitter-mylang"
rev = "v1.0.0"

and the committed parsers, queries, and stylesheet can be deleted.