From 308c3a143dbb947d92396772645b2a70362c6829 Mon Sep 17 00:00:00 2001 From: Maximilian Hils Date: Fri, 11 Oct 2024 16:30:10 +0200 Subject: [PATCH] emphasize `@deprecated` decorators (#750) --- CHANGELOG.md | 4 +- pdoc/templates/content.css | 7 +++ pdoc/templates/default/module.html.jinja2 | 2 +- test/testdata/ast_parsing.html | 2 +- test/testdata/collections_abc.html | 2 +- test/testdata/demo.html | 2 +- test/testdata/demo_eager.html | 2 +- test/testdata/demo_long.html | 14 +++--- test/testdata/demopackage.html | 2 +- test/testdata/demopackage_dir.html | 16 +++---- test/testdata/enums.html | 2 +- test/testdata/example_customtemplate.html | 2 +- test/testdata/example_darkmode.html | 2 +- test/testdata/example_mkdocs.html | 2 +- test/testdata/flavors_google.html | 2 +- test/testdata/flavors_numpy.html | 2 +- test/testdata/flavors_rst.html | 2 +- test/testdata/math_demo.html | 2 +- test/testdata/math_misc.html | 2 +- test/testdata/mermaid_demo.html | 2 +- test/testdata/misc.html | 28 ++++++------ test/testdata/misc_py310.html | 2 +- test/testdata/misc_py312.html | 2 +- test/testdata/misc_py313.html | 54 ++++++++++++++++++----- test/testdata/misc_py313.py | 8 ++++ test/testdata/misc_py313.txt | 1 + test/testdata/pyo3_sample_library.html | 2 +- test/testdata/render_options.html | 6 +-- test/testdata/top_level_reimports.html | 2 +- test/testdata/type_checking_imports.html | 2 +- test/testdata/type_stubs.html | 2 +- test/testdata/typed_dict.html | 2 +- test/testdata/visibility.html | 2 +- 33 files changed, 118 insertions(+), 68 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 795a2e6d..8e51a6a9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,8 +4,10 @@ ## Unreleased: pdoc next -- Remove support for Python 3.8, which has reached end-of-life on 2024-10-07 . +- Remove support for Python 3.8, which has reached end-of-life on 2024-10-07. ([#747](https://github.com/mitmproxy/pdoc/pull/747), @mhils) +- Python 3.13: `@deprecated` decorators are now rendered with visual emphasis. + ([#750](https://github.com/mitmproxy/pdoc/pull/750), @mhils) - Inherited members are now hidden by default if the base class is not part of the documentation. Please make yourself heard in https://github.com/mitmproxy/pdoc/issues/715 if you relied on the old behavior. ([#748](https://github.com/mitmproxy/pdoc/pull/748), @mhils) diff --git a/pdoc/templates/content.css b/pdoc/templates/content.css index 34456fff..79baa58a 100644 --- a/pdoc/templates/content.css +++ b/pdoc/templates/content.css @@ -308,6 +308,13 @@ This makes sure that the pdoc styling doesn't leak to the rest of the page when margin-left: 2rem; } +.pdoc .decorator-deprecated { + color: #842029; +} +.pdoc .decorator-deprecated ~ span { + filter: grayscale(1) opacity(0.8); +} + .pdoc .name { color: var(--name); font-weight: bold; diff --git a/pdoc/templates/default/module.html.jinja2 b/pdoc/templates/default/module.html.jinja2 index 9c4b0153..555ebdc5 100644 --- a/pdoc/templates/default/module.html.jinja2 +++ b/pdoc/templates/default/module.html.jinja2 @@ -162,7 +162,7 @@ See https://pdoc.dev/docs/pdoc/render_helpers.html#DefaultMacroExtension for an {% enddefaultmacro %} {% defaultmacro decorators(doc) %} {% for d in doc.decorators if not d.startswith("@_") %} -
{{ d }}
+
{{ d }}
{% endfor %} {% enddefaultmacro %} {% defaultmacro function(fn) -%} diff --git a/test/testdata/ast_parsing.html b/test/testdata/ast_parsing.html index 4419f91e..face783a 100644 --- a/test/testdata/ast_parsing.html +++ b/test/testdata/ast_parsing.html @@ -10,7 +10,7 @@ - +