Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/frozolotl/tree-sitter-typst
A tree-sitter grammar for the typst typesetting language with a focus on correctness
https://github.com/frozolotl/tree-sitter-typst
parser tree-sitter typst
Last synced: 3 months ago
JSON representation
A tree-sitter grammar for the typst typesetting language with a focus on correctness
- Host: GitHub
- URL: https://github.com/frozolotl/tree-sitter-typst
- Owner: frozolotl
- License: eupl-1.2
- Created: 2023-03-31T18:52:00.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2024-01-29T12:57:45.000Z (11 months ago)
- Last Synced: 2024-09-27T10:41:15.697Z (3 months ago)
- Topics: parser, tree-sitter, typst
- Language: C
- Homepage:
- Size: 6.93 MB
- Stars: 76
- Watchers: 6
- Forks: 3
- Open Issues: 14
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-typst - frozolotl/tree-sitter-typst - A tree-sitter grammar with a focus on correctness. (Integrations & Tools / Editor Integrations)
- awesome-typst-cn - frozolotl/tree-sitter-typst - sitter grammar with a focus on correctness. (编辑器集成插件 / 通用)
README
# tree-sitter-typst
A tree-sitter grammar for the [typst](https://typst.app/) typesetting language with a focus on correctness.## Goals
* This grammar will be kept as close as possible to the official parser.
Visual inaccuracies should be considered a bug.
It is however not a goal to produce the exact same syntax trees.
* Everything should be tested.
* I try to keep the grammar up-to-date. The future will show if I manage to keep that promise.## Missing Features
- [ ] Code
- [ ] Lists
- [ ] Enums
- [ ] Terms## Usage
### Helix
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.
```toml
[[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 = "" }
```Now, symlink your query files.
Alternatively, you can copy them to the correct folder, but that would make updating the grammar more difficult.
```sh
$ mkdir -p ~/.config/helix/runtime/queries/
$ ln -s /queries/ ~/.config/helix/runtime/queries/typst
```Run the following commands to fetch and build the grammar:
```sh
$ hx --grammar fetch
$ hx --grammar build
```