A tree-sitter grammar for the typst typesetting language with a focus on correctness
EUPL-1.2 License
A tree-sitter grammar for the typst typesetting language with a focus on correctness.
First, clone this repository to a path to your liking.
Append the following configuration to your ~/.config/helix/languages.toml
or %AppData%\helix\config.toml
.
Make sure you have replaced the path on the last line with the correct one.
[[language]]
name = "typst"
scope = "source.typst"
injection-regex = "^typ(st)?$"
file-types = ["typ"]
comment-token = "//"
indent = { tab-width = 2, unit = " " }
roots = ["typst.toml"]
[language.auto-pairs]
'(' = ')'
'{' = '}'
'[' = ']'
'"' = '"'
'`' = '`'
'$' = '$'
[[grammar]]
name = "typst"
source = { path = "<path to tree-sitter-typst>" }
Now, symlink your query files. Alternatively, you can copy them to the correct folder, but that would make updating the grammar more difficult.
$ mkdir -p ~/.config/helix/runtime/queries/
$ ln -s <path to tree-sitter-typst>/queries/ ~/.config/helix/runtime/queries/typst
Run the following commands to fetch and build the grammar:
$ hx --grammar fetch
$ hx --grammar build