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:
|
pawamoy
left a comment
There was a problem hiding this comment.
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. |
pawamoy
left a comment
There was a problem hiding this comment.
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_descriptionshow_docstring_attributesshow_docstring_parametersshow_docstring_other_parametersshow_docstring_raisesshow_docstring_warnsshow_docstring_yieldsshow_docstring_receivesshow_docstring_returnsshow_docstring_examplesIn 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_descriptionoption. 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.