-
-
Notifications
You must be signed in to change notification settings - Fork 40
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: add new show options for docstrings #56
Conversation
src/mkdocstrings_handlers/python/templates/material/_base/function.html
Outdated
Show resolved
Hide resolved
Option names are definitely a bit too long right now I would suggest:
For completeness, the existing two are
|
@Archmonger yea, I agree in spirit that the option names are too long, as proposed. And get where you are coming from. On the other hand, my thinking was that I'ld rather be more explicit in the option names than to keep it short & ambiguous, possibly clashing with other options / confusing users. Options are specified once, in TBH, I have a bigger gripe with the fact that, with the introduction of this many new options, how do we properly document and illustrate to the user what the effect of all these options are. And not let them feel overwhelmed by all the options. ps. on Other parameters, see here: https://mkdocstrings.github.io/griffe/docstrings/#other-parameters |
Unless we start nesting options (which I wouldn't like to start without a clear spec), I agree that the proposed option names are a bit too long. Since docstrings only have sections, we can drop that from the names:
A few questions/remarks:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent work, thanks a lot!
src/mkdocstrings_handlers/python/templates/material/_base/docstring.html
Outdated
Show resolved
Hide resolved
src/mkdocstrings_handlers/python/templates/material/_base/docstring.html
Outdated
Show resolved
Hide resolved
src/mkdocstrings_handlers/python/templates/material/_base/function.html
Outdated
Show resolved
Hide resolved
I'm planning on improving docs. Each option would be properly documented, with visual examples, etc., instead of just rendered from the docstring (this was a convenient way until now, but we can do better). Good point. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK LGTM! Thanks a lot!
I just had an idea to improve perfs of the docstring.html template but we can do that in another PR.
Pinging to remind that an issue was never created for this. Just making sure it doesn't get forgotten! |
That's not a docstring section, it's a sequence of actual attribute objects being rendered. Try removing their docstring, or filtering them out if you don't want them to appear in the docs. |
But isn't the On a tangent, I know my use case is niche but there are certain segments in my docs where I'd prefer only keeping the "concatenated" version contained within |
Sorry, I misread. Yes, the Attributes paragraph above your red rectangle seems to be generated from an Attributes section. Can you open a new issue? |
Related to mkdocstrings/mkdocstrings#466.
Changes
List of new options (view docstring in git diff for more details):
show_docstring_description
show_docstring_attributes
show_docstring_parameters
show_docstring_other_parameters
show_docstring_raises
show_docstring_warns
show_docstring_yields
show_docstring_receives
show_docstring_returns
show_docstring_examples
In total, 10 new options, covering all the docstring types.
Details:
material/_base/docstring.html
, but combinedsection.kind=="admonition"
andsection.kind=="text"
under the sameshow_docstring_description
option. Just felt strange to separate them as I can't imagine a scenario I want one but not the other, but let me know if you prefer them separated.mkdocs
,rtd
).See more comments in review.