-
-
Notifications
You must be signed in to change notification settings - Fork 44
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
Examples in Google style do not show #46
Comments
I solved this issue by changing So for the developer: I think the corresponding code in the template of How I got the solution: |
Hi again @wxdrizzle! Thanks for the detailed bug report, and the solution to the issue 😄 So the final fix will look like this: {% for section_type, sub_section in section.value %}
{% if section_type.value == "text" %}
{{ sub_section|convert_markdown(heading_level, html_id) }}
{% elif section_type.value == "examples" %}
{{ sub_section|highlight(language="python", linenums=False) }}
{% endif %}
{% endfor %} Do you want to send a PR (on the mkdocstrings/python repo) with that 🙂? If not, I'll do it in the afternoon anyway! |
Done! Will release it soon. |
Great work! Sorry that I just woke up due to the time difference. Thank you for the quick reply and quick fix @pawamoy 😄 |
Haha no problem of course 😄 |
Edited. This issue has been solved by myself. Dear developer, just see my second comment below please, and confirm whether I am correct, or whether there is a better way. Then we can close this issue.
Describe the bug
I used the google style to write my python docstrings. The "examples" section is not rendered by mkdocstrings, while other sections such as "Parameters" and "Returns" work well.
To Reproduce
Just write a docstring like:
Expected behavior
I expect that the "examples" section is rendered, just like the previous python handler's behavior.
Screenshots
You can see nothing shown below "Examples".
System (please complete the following information):
griffe
version: 0.12.6Additional context
I tried to debug that. If I change the content in
templates/python/material/_base/docstring/examples.html
fromto
Then the section will be rendered but the markdown text is also rendered as code:
Therefore, I think there may be something wrong with
{% if section_type == "markdown" %}
or{% elif section_type == "examples" %}
, making the value always "False". To confirm this, I add{{ section_type}}
and{{ section_type == "examples"}}
to the for loop, and then:You can see that the
section_type
isDocstringSectionKind.examples
, and{{ section_type == "examples"}}
is False. I then tried{{ section_type == "DocstringSectionKind.examples"}}
, but it is still False.The text was updated successfully, but these errors were encountered: