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 tree-sitter-rst 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| tree_sitter_rst-0.2.0.tar.gz | 32.9 kB | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| tree_sitter_rst-0.2.0-cp310-abi3-win_arm64.whl | CPython 3.10 | abi3 | Windows ARM64 | Details |
| tree_sitter_rst-0.2.0-cp310-abi3-win_amd64.whl | CPython 3.10 | abi3 | Windows x86-64 | Details |
| tree_sitter_rst-0.2.0-cp310-abi3-musllinux_1_2_x86_64.whl | CPython 3.10 | abi3 | Linux musl 1.2+ x86-64 | Details |
| tree_sitter_rst-0.2.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | CPython 3.10 | abi3 | Linux glibc 2.17+ x86-64 | Details |
| tree_sitter_rst-0.2.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl | CPython 3.10 | abi3 | Linux glibc 2.17+ ARM64 | Details |
| tree_sitter_rst-0.2.0-cp310-abi3-macosx_11_0_arm64.whl | CPython 3.10 | abi3 | macOS 11.0+ ARM64 | Details |
| tree_sitter_rst-0.2.0-cp310-abi3-macosx_10_9_x86_64.whl | CPython 3.10 | abi3 | macOS 10.9+ x86-64 | Details |
Total release size: 380.4 kB
Release files / tree_sitter_rst-0.2.0.tar.gz
| Download URL | tree_sitter_rst-0.2.0.tar.gz |
|---|---|
| Size | 32.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8b3e23a2f83bd6c3d43f1fcc70a381833c240dcbe84f24176041673b3b303cc4
|
|
BLAKE2b-256 checksum How to use checksums |
a8daff6b9c81594e2bb3a056fedfb980ce1c9cd9aea56c5e8851b237701fcc99
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Release files / tree_sitter_rst-0.2.0-cp310-abi3-win_arm64.whl
| Download URL | tree_sitter_rst-0.2.0-cp310-abi3-win_arm64.whl |
|---|---|
| Size | 27.7 kB |
| Tags | CPython 3.10 Windows ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
04987c0cf7cede274d5bdbe781d33d8528341c6a3709222ff56c028f56c17e1f
|
|
BLAKE2b-256 checksum How to use checksums |
d07e64ca49abec7fe38b2e1bf6a62c2cddcd013603c289e06ab624a08e459f4b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Release files / tree_sitter_rst-0.2.0-cp310-abi3-win_amd64.whl
| Download URL | tree_sitter_rst-0.2.0-cp310-abi3-win_amd64.whl |
|---|---|
| Size | 29.9 kB |
| Tags | CPython 3.10 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
7168aade70a855f6eb0bb2d7103bf7c5fc1674e307c03327380d6bc854fdf355
|
|
BLAKE2b-256 checksum How to use checksums |
a1059da00c1bd8c8e69af62be549b77a52ae40677eaf84d7ccc7f20b7eafd65d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Release files / tree_sitter_rst-0.2.0-cp310-abi3-musllinux_1_2_x86_64.whl
| Download URL | tree_sitter_rst-0.2.0-cp310-abi3-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 75.9 kB |
| Tags | CPython 3.10 Linux musl 1.2+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
34d3c5b59d3983f43ad3940fee295d534de550a768b74063c8f86210d1b4b4e1
|
|
BLAKE2b-256 checksum How to use checksums |
2ae0275feb91b76c1d90ba63c7f92dc43d9df764345b64e1d483852c699602aa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Release files / tree_sitter_rst-0.2.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | tree_sitter_rst-0.2.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 79.8 kB |
| Tags | CPython 3.10 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
2431765300b8debfb5b46d903140fcb81a6088de6aba4794f69002e547ae8d2e
|
|
BLAKE2b-256 checksum How to use checksums |
978daf3ba0080d96705a7740367701e55a1b1caed6da4efff6891a9fafaf04a1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Release files / tree_sitter_rst-0.2.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | tree_sitter_rst-0.2.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 81.3 kB |
| Tags | CPython 3.10 Linux glibc 2.17+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
8fe565cd00e829d053b227d87ba673328ac4f1fb46699c3808b7cf89b3d4801e
|
|
BLAKE2b-256 checksum How to use checksums |
44bd731d2358b7335126113ac8848625d8cc63dbaf35708b127f548d298b59c2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Release files / tree_sitter_rst-0.2.0-cp310-abi3-macosx_11_0_arm64.whl
| Download URL | tree_sitter_rst-0.2.0-cp310-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 26.4 kB |
| Tags | CPython 3.10 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
23f3a947909b71ba0f12967ca13f6d2593c84ac935d8566afd209ad4debed62d
|
|
BLAKE2b-256 checksum How to use checksums |
2051bfadd363c50186e6af4c8a9b9663b5f2e6aa2b17af03fa3341a1ea440526
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Release files / tree_sitter_rst-0.2.0-cp310-abi3-macosx_10_9_x86_64.whl
| Download URL | tree_sitter_rst-0.2.0-cp310-abi3-macosx_10_9_x86_64.whl |
|---|---|
| Size | 26.4 kB |
| Tags | CPython 3.10 abi3 macOS 10.9+ x86-64 |
|
SHA-256 checksum How to use checksums |
d2b8c3bdcc2d931b24c6b88c296cc47625a8f3f4fd2843e7b0eae894e9fd2ce9
|
|
BLAKE2b-256 checksum How to use checksums |
9169d3cf891e9d924e8a4ab3143eb992f01382d45bb06afca3ffa0078e66d2f6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|