Skip to content

Commit

Permalink
feat: Support examples section
Browse files Browse the repository at this point in the history
References: #112

Co-authored-by: Iago GR <igonro@gmail.com>

Co-authored-by: Timothée Mazzucotelli <pawamoy@pm.me>
  • Loading branch information
igonro and pawamoy authored Jun 9, 2020
1 parent af6a7f8 commit 650c754
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/mkdocstrings/templates/python/material/docstring.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
{% with return = section.value %}
{% include "return.html" with context %}
{% endwith %}
{% elif section.type == "examples" %}
{% with examples = section.value %}
{% include "examples.html" with context %}
{% endwith %}
{% endif %}
{% endfor %}
{% endif %}
8 changes: 8 additions & 0 deletions src/mkdocstrings/templates/python/material/examples.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<p><strong>Examples:</strong></p>
{% for section_type, sub_section in examples %}
{% if section_type == "markdown" %}
{{ sub_section|convert_markdown }}
{% elif section_type == "examples" %}
{{ sub_section|highlight(language="python", line_nums=False) }}
{% endif %}
{% endfor %}

0 comments on commit 650c754

Please sign in to comment.