reStructuredText grammar for tree-sitter
Project description
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).
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tree_sitter_rst-0.2.0.tar.gz.
File metadata
- Download URL: tree_sitter_rst-0.2.0.tar.gz
- Upload date:
- Size: 32.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8b3e23a2f83bd6c3d43f1fcc70a381833c240dcbe84f24176041673b3b303cc4
|
|
| MD5 |
97304bc552b64ff1dc73dcbdd08c0744
|
|
| BLAKE2b-256 |
a8daff6b9c81594e2bb3a056fedfb980ce1c9cd9aea56c5e8851b237701fcc99
|
File details
Details for the file tree_sitter_rst-0.2.0-cp310-abi3-win_arm64.whl.
File metadata
- Download URL: tree_sitter_rst-0.2.0-cp310-abi3-win_arm64.whl
- Upload date:
- Size: 27.7 kB
- Tags: CPython 3.10+, Windows ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
04987c0cf7cede274d5bdbe781d33d8528341c6a3709222ff56c028f56c17e1f
|
|
| MD5 |
dc4111c7b551c2cebcb3d3f04d56723f
|
|
| BLAKE2b-256 |
d07e64ca49abec7fe38b2e1bf6a62c2cddcd013603c289e06ab624a08e459f4b
|
File details
Details for the file tree_sitter_rst-0.2.0-cp310-abi3-win_amd64.whl.
File metadata
- Download URL: tree_sitter_rst-0.2.0-cp310-abi3-win_amd64.whl
- Upload date:
- Size: 29.9 kB
- Tags: CPython 3.10+, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7168aade70a855f6eb0bb2d7103bf7c5fc1674e307c03327380d6bc854fdf355
|
|
| MD5 |
4fcb09e42ab8543adb5ed69afeaba46c
|
|
| BLAKE2b-256 |
a1059da00c1bd8c8e69af62be549b77a52ae40677eaf84d7ccc7f20b7eafd65d
|
File details
Details for the file tree_sitter_rst-0.2.0-cp310-abi3-musllinux_1_2_x86_64.whl.
File metadata
- Download URL: tree_sitter_rst-0.2.0-cp310-abi3-musllinux_1_2_x86_64.whl
- Upload date:
- Size: 75.9 kB
- Tags: CPython 3.10+, musllinux: musl 1.2+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
34d3c5b59d3983f43ad3940fee295d534de550a768b74063c8f86210d1b4b4e1
|
|
| MD5 |
bca5b932b81ff1999fee327d371cb7c0
|
|
| BLAKE2b-256 |
2ae0275feb91b76c1d90ba63c7f92dc43d9df764345b64e1d483852c699602aa
|
File details
Details for the file tree_sitter_rst-0.2.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: tree_sitter_rst-0.2.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 79.8 kB
- Tags: CPython 3.10+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2431765300b8debfb5b46d903140fcb81a6088de6aba4794f69002e547ae8d2e
|
|
| MD5 |
de211757b2131ea255241ed216c2f19c
|
|
| BLAKE2b-256 |
978daf3ba0080d96705a7740367701e55a1b1caed6da4efff6891a9fafaf04a1
|
File details
Details for the file tree_sitter_rst-0.2.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: tree_sitter_rst-0.2.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 81.3 kB
- Tags: CPython 3.10+, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8fe565cd00e829d053b227d87ba673328ac4f1fb46699c3808b7cf89b3d4801e
|
|
| MD5 |
ce742a8429dc10985e793aeb7bdc1f01
|
|
| BLAKE2b-256 |
44bd731d2358b7335126113ac8848625d8cc63dbaf35708b127f548d298b59c2
|
File details
Details for the file tree_sitter_rst-0.2.0-cp310-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: tree_sitter_rst-0.2.0-cp310-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 26.4 kB
- Tags: CPython 3.10+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
23f3a947909b71ba0f12967ca13f6d2593c84ac935d8566afd209ad4debed62d
|
|
| MD5 |
cfa56127b2fcb41ec4991cb0f8591cfc
|
|
| BLAKE2b-256 |
2051bfadd363c50186e6af4c8a9b9663b5f2e6aa2b17af03fa3341a1ea440526
|
File details
Details for the file tree_sitter_rst-0.2.0-cp310-abi3-macosx_10_9_x86_64.whl.
File metadata
- Download URL: tree_sitter_rst-0.2.0-cp310-abi3-macosx_10_9_x86_64.whl
- Upload date:
- Size: 26.4 kB
- Tags: CPython 3.10+, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d2b8c3bdcc2d931b24c6b88c296cc47625a8f3f4fd2843e7b0eae894e9fd2ce9
|
|
| MD5 |
9e771ce5b618bd0e038ce5ec18736949
|
|
| BLAKE2b-256 |
9169d3cf891e9d924e8a4ab3143eb992f01382d45bb06afca3ffa0078e66d2f6
|