Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support the @deprecated decorator #668

Open
DetachHead opened this issue Feb 7, 2024 · 1 comment
Open

support the @deprecated decorator #668

DetachHead opened this issue Feb 7, 2024 · 1 comment

Comments

@DetachHead
Copy link

Problem Description

python now has a @deprecated decorator: https://peps.python.org/pep-0702/

in pdoc it's just treated like a normal decorator and is quite easy to miss:
image

Proposal

display the deprecated message as a warning, something like this:

image

Additional context

the decorator isn't coming to python until 3.13, but it can currently be used older python versions by importing it from typing_extensions. vscode already supports it too

@mhils
Copy link
Member

mhils commented Feb 12, 2024

I like the idea, but implementation-wise I don't particularly like decorators having a magic effect on docstrings. One viable workaround here could be to add the decorator name to the CSS class and then apply a CSS filter like so:

section:has(.decorator-deprecated) {
    filter: grayscale(1) opacity(0.8);
}

image

This is just one idea - we could also do a CSS thing that highights the @deprecated annotation like so:

.decorator-deprecated {
    background: #ffe91d78;
    margin-left: -15px;
    padding-left: 15px;
    margin-right: -5px;
    padding-right: 5px;
}

image

Maybe that's better because it's less likely to run into accessibility issues. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants