Skip to content

Commit 0527487

Browse files
fix: Respect highlight's linenums config for pycon examples in docstrings
The reasoning is that someone enabling line numbers globally supposedly also wants them for code blocks in docstrings. There's in my opinion no difference between a code block in a Markdown document and a code block in a docstring, they both serve documentation purposes and should be subject to the same rendering rules. If that makes someone unhappy, we can always consider adding an option to hide line numbers for code blocks in docstrings. Related-to-#192: mkdocstrings/python#192
1 parent b8c87b9 commit 0527487

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/mkdocstrings_handlers/python/templates/material/_base/docstring/examples.html.jinja

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,6 @@ Context:
2323
{% if section_type.value == "text" %}
2424
{{ sub_section|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }}
2525
{% elif section_type.value == "examples" %}
26-
{{ sub_section|highlight(language="pycon", linenums=False) }}
26+
{{ sub_section|highlight(language="pycon") }}
2727
{% endif %}
2828
{% endfor %}

0 commit comments

Comments
 (0)