stsewd / tree-sitter-rst

reStructuredText grammar for tree-sitter
https://stsewd.dev/tree-sitter-rst/
MIT License
50 stars 7 forks source link

allow space between directive name and double colon ? #18

Closed Carreau closed 2 years ago

Carreau commented 2 years ago

It looks like docutils/sphinx allow directive with spaces, that is to say:

.. name :: 

instead of

.. name::

This usage seem to be extremely rare, and I'm going to attempt sending patch to projects that uses this syntax in a couple of places, but I wanted to make you aware. I don't know if you believe it is worth supporting.

stsewd commented 2 years ago

Thanks! I think it should be easy to support.

Carreau commented 2 years ago

Thanks, i've also sent PRs to numpy/scipy/matplotlib/scikit-image to remove the spaces. So if you ever need to not use spaces. So if you ever want to make this emit a warning or revert I think that's ok. I was just unsure how much compliance you wanted with docutils/ other rst parsers.

stsewd commented 2 years ago

I'm trying to follow https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html the closest possible, but the spec isn't very specific about some things, like allowing a single space before :: p: