Skip to content

Commit c270d68

Browse files
committed
fix: Only show source when present
1 parent dbb580a commit c270d68

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/mkdocstrings/templates/python/material/_base/class.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
{% include "docstring.html" with context %}
5555
{% endwith %}
5656

57-
{% if config.show_source %}
57+
{% if config.show_source and class.source %}
5858
<details class="quote">
5959
<summary>Source code in <code>{{ class.relative_filepath }}</code></summary>
6060
{{ class.source|highlight(language="python", linestart=class.lineno, linenums=True) }}

src/mkdocstrings/templates/python/material/_base/function.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
{% include "docstring.html" with context %}
6363
{% endwith %}
6464

65-
{% if config.show_source %}
65+
{% if config.show_source and function.source %}
6666
<details class="quote">
6767
<summary>Source code in <code>{{ function.relative_filepath }}</code></summary>
6868
{{ function.source|highlight(language="python", linestart=function.lineno, linenums=True) }}

0 commit comments

Comments
 (0)