diff --git a/CHANGELOG.md b/CHANGELOG.md index 8901f53f..eb8f7a3e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,8 @@ ([#831](https://github.com/mitmproxy/pdoc/issues/831), @iFreilicht) - Replace vendored version of `markdown2` with the [official upstream](https://github.com/trentm/python-markdown2) +- Add support for keyword args for Google flavor docs. + ([#840](https://github.com/mitmproxy/pdoc/pull/840), @aleksslitvinovs) ## 2025-06-04: pdoc 15.0.4 diff --git a/pdoc/docstrings.py b/pdoc/docstrings.py index 9cc062ce..9d45e209 100644 --- a/pdoc/docstrings.py +++ b/pdoc/docstrings.py @@ -104,13 +104,15 @@ def google(docstring: str) -> str: ) -GOOGLE_LIST_SECTIONS = ["Args", "Raises", "Attributes"] +GOOGLE_LIST_SECTIONS = ["Args", "Raises", "Attributes", "Keyword Args"] """Section headers listed in the official Google docstring style guide.""" GOOGLE_LIST_SECTION_ALIASES = { "Parameters": "Args", "Params": "Args", "Arguments": "Args", + "Raise": "Raises", + "Keyword Arguments": "Keyword Args", } """ Alternative section headers that are not listed in the official Google diff --git a/test/testdata/flavors_google.html b/test/testdata/flavors_google.html index c25b40de..105b808a 100644 --- a/test/testdata/flavors_google.html +++ b/test/testdata/flavors_google.html @@ -131,6 +131,9 @@
458def keyword_arguments(**kwargs): +459 """ +460 This an example for a function with keyword arguments documented in the docstring. +461 +462 Args: +463 **kwargs: A dictionary containing user info. +464 +465 Keyword Arguments: +466 str_arg (str): First string argument. +467 int_arg (int): Second integer argument. +468 """ +
This an example for a function with keyword arguments documented in the docstring.
+ +