tree-sitter-rst
reStructuredText grammar for tree-sitter. Based on the specification from https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html.
Check the playground at https://stsewd.dev/tree-sitter-rst/.
Note: this grammar is still under development, a lot of things may change!
TODO
- Allow lists with blank lines between items
- Refactor parse citation and footer reference
- Nested line blocks
- Option lists
- Add some nodes to inline?
- Check if there is a way to re-implement some nodes to JS instead of C?
- A definition list with classifiers can't be separated by a blank line.
- tests, tests, and more tests!
Design notes
- Nodes that contain body elements inside (like lists or directives),
are inside a node named
body. - In RST sections are a big node that contains body elements, here they are just a node containing the title. This is to avoid guessing the level of subtitles.
- In RST standalone hyperlinks are
referencenodes, here they arestandalone_hyperlinknodes. This is to avoid confusion with inline references nodes (that are areferencenode). - Literal blocks are part of the paragraph they precede, not a separate node, except for the expanded form of literal blocks.
- In rst directives only have "body" node, here the body is parsed as arguments/options/content.
Design decisions
-
Implement tables?
-
Validate length of adornments in sections?
The spec doesn't mention this, but this paragraph does.
The underline/overline must be at least as long as the title text.
https://docutils.sourceforge.io/docs/user/rst/quickstart.html
Projects using this grammar
- nvim-treesitter
- helix
- zed-rst
- Yours?
Contributing
Check the CONTRIBUTING.md file
Other grammars
- tree-sitter-comment: grammar for comment tags like
TODO,FIXME(user).
Release files for py-tree-sitter-rst 0.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| py_tree_sitter_rst-0.2.2.tar.gz | 60.5 kB | Details |
Built distributions (wheels)
Total release size: 542.7 kB
Release files / py_tree_sitter_rst-0.2.2.tar.gz
| Download URL | py_tree_sitter_rst-0.2.2.tar.gz |
|---|---|
| Size | 60.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
622c822e15303b3e5c5b6893c6486a44bd3ebf04aafdae5f267103c67f8a628c
|
|
BLAKE2b-256 checksum How to use checksums |
b226a702029075ed06cfd232ece8f9216d17fd2abcdf98c37735d1a2749f335b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Release files / py_tree_sitter_rst-0.2.2-cp310-abi3-win_arm64.whl
| Download URL | py_tree_sitter_rst-0.2.2-cp310-abi3-win_arm64.whl |
|---|---|
| Size | 31.6 kB |
| Tags | CPython 3.10 Windows ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
d85ed0b1369a35456024b5a454cdfae30d2eb98f064a8b00bd30fc3e19478a18
|
|
BLAKE2b-256 checksum How to use checksums |
dd7def0a49a8df580cf884cd04f8e65d469a9b496f95e33da84c777fff80a459
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Release files / py_tree_sitter_rst-0.2.2-cp310-abi3-win_amd64.whl
| Download URL | py_tree_sitter_rst-0.2.2-cp310-abi3-win_amd64.whl |
|---|---|
| Size | 33.6 kB |
| Tags | CPython 3.10 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
98661a51fed1ef3b3f07f3387c72d12f68078182cf7d2ca4556feaaeab08a8e4
|
|
BLAKE2b-256 checksum How to use checksums |
ce69e5647bd8199c24d49ccfe34a8215dd94ed28ad4ad221626d55949b50c339
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Release files / py_tree_sitter_rst-0.2.2-cp310-abi3-musllinux_1_2_x86_64.whl
| Download URL | py_tree_sitter_rst-0.2.2-cp310-abi3-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 84.2 kB |
| Tags | CPython 3.10 Linux musl 1.2+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
2ff065f3089b438e0759f6f32ff6deaa26cd5589b0ed5786ab2cf2309f8ebe87
|
|
BLAKE2b-256 checksum How to use checksums |
950ae1b5e8c191df580efacb73d893516d1fe2d6ebf1b920018f066153128acd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Release files / py_tree_sitter_rst-0.2.2-cp310-abi3-musllinux_1_2_aarch64.whl
| Download URL | py_tree_sitter_rst-0.2.2-cp310-abi3-musllinux_1_2_aarch64.whl |
|---|---|
| Size | 90.1 kB |
| Tags | CPython 3.10 Linux musl 1.2+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
7baf94626298aef190b984618fb6ac23ff005d1f5a0e0a30029f67c6a131a6cd
|
|
BLAKE2b-256 checksum How to use checksums |
4b624df5b3843c1d952e27532869eda9b12417971b3f91ac20baa7e88c7a3548
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Release files / py_tree_sitter_rst-0.2.2-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
| Download URL | py_tree_sitter_rst-0.2.2-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 85.3 kB |
| Tags | CPython 3.10 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
381974aa88f4dbef715aadc990cbef6769c5dfd26de66e8caffa762c5d25c813
|
|
BLAKE2b-256 checksum How to use checksums |
ffc1e6cd2feef69b7592a5850468ff1cc963d83c689ca82545ec1f9da4a37557
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Release files / py_tree_sitter_rst-0.2.2-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
| Download URL | py_tree_sitter_rst-0.2.2-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl |
|---|---|
| Size | 91.9 kB |
| Tags | CPython 3.10 Linux glibc 2.17+ ARM64 Linux glibc 2.28+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
7b03567e55c0ce83b96099a53b22ce09bb35ab6ceaeddbf4b60e3f374229e44d
|
|
BLAKE2b-256 checksum How to use checksums |
20787c9a595037fc21be0bd81cdbf8a8aa6bacd1fb151355d665d3bb482e8650
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Release files / py_tree_sitter_rst-0.2.2-cp310-abi3-macosx_11_0_arm64.whl
| Download URL | py_tree_sitter_rst-0.2.2-cp310-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 32.8 kB |
| Tags | CPython 3.10 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
8883f1ae5f6164431e60a25e738091483bec5ec0a599ddbcf4178767ba1a13ed
|
|
BLAKE2b-256 checksum How to use checksums |
c0d2479671f594cc835133223e9c396db7d28c90854e06a0f67eb24e4aaf8ad8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Release files / py_tree_sitter_rst-0.2.2-cp310-abi3-macosx_10_9_x86_64.whl
| Download URL | py_tree_sitter_rst-0.2.2-cp310-abi3-macosx_10_9_x86_64.whl |
|---|---|
| Size | 32.6 kB |
| Tags | CPython 3.10 abi3 macOS 10.9+ x86-64 |
|
SHA-256 checksum How to use checksums |
742d84ff805a29ddc0b245c3c5a72c55f5123970282b791f79bed43b45e280e4
|
|
BLAKE2b-256 checksum How to use checksums |
51927fd2241d9164cefb3e26ce09368d2e5657dc5f000a88eb17b8af99c28f82
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|