-
Notifications
You must be signed in to change notification settings - Fork 50
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
Google style docstring and sphinx directives issue #42
Comments
Where can I read more about this syntax? The reason it gets parsed as |
The crash is now fixed in 0.9.1, although the example won't parse properly. |
@rr- you can read about this syntax in https://www.sphinx-doc.org/en/master/usage/extensions/doctest.html. @Andry-Bal a question regarding the example. Shouldn't the |
Looking at https://google.github.io/styleguide/pyguide.html#38-comments-and-docstrings, which I guess is the definition of the google style, the only defined sections are |
I would say it should be indented by four spaces like the sections under |
Looking at the sphinx napoleon extension (which is what is used to handle google style docstrings), I think On another note I think that docstring-parser should have the same behavior as napoleon. With the wrong indentation the example content is not lost. Not sure how it works internally but in a rendered html it looks like |
In Griffe we had similar false-positives in Google-style docstrings: matching sections which weren't. I've fixed that by setting stricter rules for section matching in the parser. A section is only a section if:
See https://mkdocstrings.github.io/griffe/docstrings/#google-style. For example, Ruff implemented rules D411 and D412 coming from pydocstyle itself. This is a tricky situation though: sometimes the user did want to write a section, and used incorrect spacing, and sometimes the user did not want to write a section, and it should then be parsed as regular markup. In Griffe we don't warn or error out on incorrect section syntax, we only log a debug message saying "if you wanted a section, here's what's wrong with your syntax". |
The following code snippet causes everything after
Example:
to be parsed aslong_description
. As a consequence,params
andraises
are lost.The text was updated successfully, but these errors were encountered: