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

Allow wrapping .. deprecated:: directive in admonitions #62

Open
pvandyken opened this issue Feb 18, 2023 · 0 comments
Open

Allow wrapping .. deprecated:: directive in admonitions #62

pvandyken opened this issue Feb 18, 2023 · 0 comments

Comments

@pvandyken
Copy link

I'd like the ability to wrap deprecation warnings within another sphinx admonition such as info or warning. My idea is to have an admonition argument in deprecated() which defaults to None but optionally takes the name of an admonition. The results would be as follows:

@deprecated(deprecated_in="1.0", details="This function is deprecated")
def my_func():
    """Docstring for the function"""

# leads to the following docstring:
"""Docstring for the function

.. deprecated::1.0
    This function is deprecated
"""

# versus
@deprecated(deprecated_in="1.0", details="This function is deprecated", admonition='warning')
def my_func():
    """Docstring for the function"""

# leads to the following docstring:
"""Docstring for the function

.. warning::
  .. deprecated::1.0
      This function is deprecated
"""

I already have clone with this implemented, the patch is very straightforward. If you agree to implement this I can make a PR.

Happy to change the name of the argument if you prefer as well.

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

No branches or pull requests

1 participant