You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Google list sections recognises currently only "Args", "Raises" and "Attributes" as headers for sections that consist of a definition list. This could be extended to recognise more section headers, similar to what sphinx already does.
The list of sections that sphinx supports is quite extensive, but I'd suggest at least adopting "Keyword Args", "Keyword Arguments", "Yields" and "Examples". The "Yields" header is specifically mentioned by Google as an alternative to "Returns", and I have seen "Examples" mentioned in older versions of the style guide. The keyword arguments are not specified by Google as such, but are widely used.
There are also other list-type sections on the Sphinx list, so implementing as much as possible would improve Sphinx compatibility a lot.
The text was updated successfully, but these errors were encountered:
Contributions are welcome here, the relevant code is in https://github.com/mitmproxy/pdoc/blob/main/pdoc/docstrings.py. :) That being said, my general take here is that type info should live in the type annotation, and then the sections do render fine already. I don't mind additions that come with test coverage though!
I've started addressing an issue similar to this in #489; my use-case is that I have a large codebase spanning several repositories where the docstrings are Google-styled but they use "Parameters" instead of "Args" in the headings. PR #489 could be extended to support the alternatives listed in this issue.
Note that according to my experience, "Yields" is correctly handled by pdoc because it is a section whose body is not a list; pdoc already converts the header to a Markdown header. "Keyword Args" would need special treatment, and "Keyword Arguments" could be aliases to "Keyword Args" in PR #489.
The Google list sections recognises currently only "Args", "Raises" and "Attributes" as headers for sections that consist of a definition list. This could be extended to recognise more section headers, similar to what sphinx already does.
The list of sections that sphinx supports is quite extensive, but I'd suggest at least adopting "Keyword Args", "Keyword Arguments", "Yields" and "Examples". The "Yields" header is specifically mentioned by Google as an alternative to "Returns", and I have seen "Examples" mentioned in older versions of the style guide. The keyword arguments are not specified by Google as such, but are widely used.
There are also other list-type sections on the Sphinx list, so implementing as much as possible would improve Sphinx compatibility a lot.
The text was updated successfully, but these errors were encountered: