Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/autodoc2/render/myst_.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ def render_class(self, item: ItemData) -> t.Iterable[str]:
lines.extend(["```", ""])

for child in self.get_children(
item, {"class", "property", "attribute", "method"}
item, {"class", "property", "attribute", "method", "exception"}
):
if (
child["full_name"].endswith(".__init__")
Expand Down
2 changes: 1 addition & 1 deletion src/autodoc2/render/rst_.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ def render_class(self, item: ItemData) -> t.Iterable[str]:
yield ""

for child in self.get_children(
item, {"class", "property", "attribute", "method"}
item, {"class", "property", "attribute", "method", "exception"}
):
if (
child["full_name"].endswith(".__init__")
Expand Down
3 changes: 3 additions & 0 deletions tests/test_render.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,9 @@ def prop(self) -> alias | None:

class Nested:
'''This is a nested class.'''

class NestedEx(Exception):
'''This is a nested exception.'''
"""
),
"utf-8",
Expand Down
16 changes: 16 additions & 0 deletions tests/test_render/test_basic_myst_.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,4 +129,20 @@ package.a

````

````{py:exception} NestedEx()
:canonical: package.Class.NestedEx

Bases: {py:obj}`Exception`

```{autodoc2-docstring} package.Class.NestedEx
```

```{rubric} Initialization
```

```{autodoc2-docstring} package.Class.NestedEx.__init__
```

````

`````
11 changes: 11 additions & 0 deletions tests/test_render/test_basic_rst_.rst
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,14 @@ API
:canonical: package.Class.Nested

.. autodoc2-docstring:: package.Class.Nested

.. py:exception:: NestedEx()
:canonical: package.Class.NestedEx

Bases: :py:obj:`Exception`

.. autodoc2-docstring:: package.Class.NestedEx

.. rubric:: Initialization

.. autodoc2-docstring:: package.Class.NestedEx.__init__