diff --git a/pdoc/html_helpers.py b/pdoc/html_helpers.py index d727655c..f5e7e441 100644 --- a/pdoc/html_helpers.py +++ b/pdoc/html_helpers.py @@ -248,14 +248,14 @@ def googledoc_sections(match): section = section.title() if section in ('Args', 'Attributes'): body = re.compile( - r'^([\w*]+)(?: \(([\w.,=\[\] -]+)\))?: ' + r'^([\w*]+)(?: \(([\w.,=|\[\] -]+)\))?: ' r'((?:.*)(?:\n(?: {2,}.*|$))*)', re.MULTILINE).sub( lambda m: _ToMarkdown._deflist(*_ToMarkdown._fix_indent(*m.groups())), inspect.cleandoc(f'\n{body}') ) elif section in ('Returns', 'Yields', 'Raises', 'Warns'): body = re.compile( - r'^()([\w.,\[\] ]+): ' + r'^()([\w.,|\[\] ]+): ' r'((?:.*)(?:\n(?: {2,}.*|$))*)', re.MULTILINE).sub( lambda m: _ToMarkdown._deflist(*_ToMarkdown._fix_indent(*m.groups())), inspect.cleandoc(f'\n{body}') diff --git a/pdoc/test/__init__.py b/pdoc/test/__init__.py index 93b9c771..6f706b03 100644 --- a/pdoc/test/__init__.py +++ b/pdoc/test/__init__.py @@ -1457,6 +1457,8 @@ def test_google(self):
Description of arg1
arg2 : str or int
Description of arg2
+
arg3 : str | None
+
Description of arg3
test_sequence

2-dim numpy array of real numbers, size: N * D @@ -1484,6 +1486,11 @@ def test_google(self):

Dict[int, pdoc.Doc]
Description.
+

Returns

+
+
int | str
+
Description.
+

Raises

AttributeError
diff --git a/pdoc/test/example_pkg/__init__.py b/pdoc/test/example_pkg/__init__.py index 1c532c2c..308aab64 100644 --- a/pdoc/test/example_pkg/__init__.py +++ b/pdoc/test/example_pkg/__init__.py @@ -223,6 +223,7 @@ def google(self): Args: arg1 (int): Description of arg1 arg2 (str or int): Description of arg2 + arg3 (str | None): Description of arg3 test_sequence: 2-dim numpy array of real numbers, size: N * D - the test observation sequence. @@ -244,6 +245,9 @@ def google(self): Returns: Dict[int, pdoc.Doc]: Description. + Returns: + int | str: Description. + Raises: AttributeError: The ``Raises`` section is a list of all exceptions that are relevant to the interface.