Skip to content

Commit d82a93a

Browse files
committed
docs: Generate "Deprecated" admonitions automatically
Wire the `griffe-warnings-deprecated` extension into the mkdocstrings handler options, so every symbol decorated with `typing_extensions.deprecated` gets a "Deprecated" admonition in the API reference with no docstring edit at all. The extension's `kind` is set to `deprecated` rather than the default `warning`, so it emits `class="deprecated"`, which is exactly what a hand-written `Deprecated:` admonition produces. The CSS rule added in the previous commit then styles both, and the two are visually indistinguishable. That matters because the decorator cannot reach everything: module-level aliases, a single function argument, enum members and whole modules still need the admonition written by hand. Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
1 parent a38ca9d commit d82a93a

2 files changed

Lines changed: 5 additions & 0 deletions

File tree

‎mkdocs.yml‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,10 @@ plugins:
101101
python:
102102
paths: ["src"]
103103
options:
104+
extensions:
105+
- griffe_warnings_deprecated:
106+
kind: deprecated
107+
title: Deprecated
104108
docstring_section_style: spacy
105109
inherited_members: true
106110
merge_init_into_class: false

‎pyproject.toml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ dev-flake8 = [
5555
dev-formatting = ["black == 26.5.1", "isort == 8.0.1"]
5656
dev-mkdocs = [
5757
"black == 26.5.1",
58+
"griffe-warnings-deprecated == 1.1.1",
5859
"Markdown==3.10.3",
5960
"mike == 2.2.0",
6061
"mkdocs-gen-files == 0.6.1",

0 commit comments

Comments
 (0)