Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

investigate tree-sitter rst handling of trailing letters after backticks. #275

Open
Carreau opened this issue Sep 7, 2023 · 5 comments
Open
Labels

Comments

@Carreau
Copy link
Member

Carreau commented Sep 7, 2023

I believe that tree sitter rst parse a few `object`s differently than docutils, I think that raises warning in building some of the docs.

@Carreau
Copy link
Member Author

Carreau commented Sep 7, 2023

I think that affect for example:

scipy/stats/_resampling.py
791:        `statistic`. Memory usage is O(`batch`*``sample.size[axis]``). Default
scipy/stats/_continuous_distns.py
4835:    where `x > 0`, `p` is a real number and `b > 0`([1]_)

@asmeurer
Copy link
Collaborator

asmeurer commented Sep 7, 2023

a few `object`s gives a WARNING: Inline interpreted text or phrase reference start-string without end-string. warning with Sphinx, and renders as-is (i.e., the backquotes are ignored).

The SciPy examples are both wrong. You can see in the online docs that they don't render correctly https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.bootstrap.html https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.geninvgauss.html. Unfortunately, it seems these do not actually produce any warnings from Sphinx/docutils. If tree-sitter-rst actually does give warnings here that's a nice feature.

The RST spec is very specific about what is allowed here:

Inline markup end-strings must end a text block or be immediately followed by

  • whitespace,
  • one of the ASCII characters - . , : ; ! ? \ / ' " ) ] } >
  • or a similar non-ASCII punctuation character.

Everything else must be escaped with a backslash

Of course, I have no idea if tree-sitter-rst actually follows all these rules, but the examples given here don't show any issues with it. I would suggest closing this PR and submitting upstream fixes to libraries like scipy to fix their RST formatting.

@Carreau
Copy link
Member Author

Carreau commented Sep 12, 2023

Thanks for looking at the SciPy docs, it's indeed improperly render.

Let's keep this open in case we found other case, but let's try to send patches upstream to fix the SciPy docs, so we don't have errors.

@Carreau
Copy link
Member Author

Carreau commented Sep 12, 2023

I think there might be some case where tree-sitter-rst does

791:        `statistic`. Memory usage is O(`batch`*``sample.size[axis]``). Default
            ^ open quote                   ^ closing quote

I have to recheck.

@Carreau
Copy link
Member Author

Carreau commented Sep 12, 2023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants