Skip to main content

reStructuredText grammar for tree-sitter

Project description

tree-sitter-rst

CI PyPI - Version NPM Version Crates.io Version

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 reference nodes, here they are standalone_hyperlink nodes. This is to avoid confusion with inline references nodes (that are a reference node).
  • 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

Projects using this grammar

Contributing

Check the CONTRIBUTING.md file

Other grammars

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

py_tree_sitter_rst-0.2.0.tar.gz (60.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

py_tree_sitter_rst-0.2.0-cp310-abi3-macosx_11_0_arm64.whl (30.6 kB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

File details

Details for the file py_tree_sitter_rst-0.2.0.tar.gz.

File metadata

  • Download URL: py_tree_sitter_rst-0.2.0.tar.gz
  • Upload date:
  • Size: 60.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for py_tree_sitter_rst-0.2.0.tar.gz
Algorithm Hash digest
SHA256 101cbf1eb34f19583ad64e4e7f1f995ca855e0969e08f18b2f7d31cdf7ea787b
MD5 1406de2ba947851fc18104e2537b0951
BLAKE2b-256 c9af7679a826eaba4a94fd46c51d4f96ec5d2cd244278cdfdd630bef5ea63ce9

See more details on using hashes here.

File details

Details for the file py_tree_sitter_rst-0.2.0-cp310-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for py_tree_sitter_rst-0.2.0-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 bade8e1790f0410c55a3c974cdd2c8e4e9d453f9f39fb8061034c2b7de161cd8
MD5 261b94d7c43bfd854a18bd66fb18fd52
BLAKE2b-256 62daedf41ee54c418f7940c66fd54adf29ef134d209da7aedfd2c251279f7b64

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page