Skip to content

Commit 73f11dc

Browse files
committed
fix: Always render cross-references outside of signatures
Issue-mkdocstrings#700: mkdocstrings/mkdocstrings#700
1 parent e6b7542 commit 73f11dc

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/mkdocstrings_handlers/python/templates/material/_base/expression.html.jinja

+8-7
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,16 @@ which is a tree-like structure representing a Python expression.
3232
{%- set annotation = full -%}
3333
{%- endif -%}
3434
{%- for title, path in annotation|split_path(full) -%}
35-
{%- if config.signature_crossrefs -%}
36-
{%- if signature -%}
37-
{%- filter stash_crossref(length=title|length) -%}
38-
<autoref identifier="{{ path }}" optional{% if title != path %} hover{% endif %}>{{ title }}</autoref>
39-
{%- endfilter -%}
40-
{%- else -%}
35+
{%- if not signature -%}
36+
{#- Always render cross-references outside of signatures. We don't need to stash them. -#}
37+
<autoref identifier="{{ path }}" optional{% if title != path %} hover{% endif %}>{{ title }}</autoref>
38+
{%- elif config.signature_crossrefs -%}
39+
{#- We're in a signature and cross-references are enabled, we must render one and stash it. -#}
40+
{%- filter stash_crossref(length=title|length) -%}
4141
<autoref identifier="{{ path }}" optional{% if title != path %} hover{% endif %}>{{ title }}</autoref>
42-
{%- endif -%}
42+
{%- endfilter -%}
4343
{%- else -%}
44+
{#- We're in a signature but cross-references are disabled, we just render the title. -#}
4445
{{ title }}
4546
{%- endif -%}
4647
{%- if not loop.last -%}.{%- endif -%}

0 commit comments

Comments
 (0)