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

feat: remove annotations for properties in attributes section of summary #242

Merged

Conversation

elfkuzco
Copy link
Contributor

@elfkuzco elfkuzco commented Feb 4, 2025

Rationale

When summary is set to True in mkdocs.yml, one-line @property attributes are shown as they are without the stripping of the annotation. For example str: xxxxxx is shown as str:xxxx in the Attributes section of the summary. This PR strips out any annotations, effectively leaving the xxxxxxx part in the summary which is what is desired.

Changes

  • add helper function in do_as_attributes_section to parse the description from the docstring accounting for @property style docstrings too.

@elfkuzco elfkuzco changed the title feat: remove annotations for properties in attributes section feat: remove annotations for properties in attributes section of summary Feb 4, 2025
Copy link
Member

@pawamoy pawamoy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for your contribution @elfkuzco!

@elfkuzco elfkuzco force-pushed the remove-annotations-from-attrs-summary branch from 856cfbd to bd596a1 Compare February 5, 2025 14:44
@elfkuzco elfkuzco requested a review from pawamoy February 5, 2025 14:47
Copy link
Member

@pawamoy pawamoy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks a lot!

@pawamoy pawamoy merged commit 15f2cd4 into mkdocstrings:main Feb 5, 2025
22 of 26 checks passed
viktorlashchuk added a commit to viktorlashchuk/mkdocstrings-python that referenced this pull request Feb 24, 2025
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

Successfully merging this pull request may close these issues.

2 participants