Skip to content

Commit c4506f0

Browse files
committed
refactor: Render * and ** outside of cross-references in signatures
Needed-for-PR-216: #216
1 parent cea4996 commit c4506f0

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

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

+5-5
Original file line numberDiff line numberDiff line change
@@ -72,27 +72,27 @@ Context:
7272
{%- endif -%}
7373

7474
{#- Prepare name. -#}
75-
{%- set param_name -%}
75+
{%- set param_prefix -%}
7676
{%- if parameter.kind.value == "variadic positional" -%}
7777
*
7878
{%- elif parameter.kind.value == "variadic keyword" -%}
7979
**
8080
{%- endif -%}
81-
{{ parameter.name }}
8281
{%- endset -%}
8382

8483
{#- Render parameter name with optional cross-reference to its heading. -#}
84+
{{ param_prefix }}
8585
{%- if config.separate_signature and config.parameter_headings and config.signature_crossrefs -%}
86-
{%- filter stash_crossref(length=param_name|length) -%}
86+
{%- filter stash_crossref(length=parameter.name|length) -%}
8787
{%- with func_path = function.path -%}
8888
{%- if config.merge_init_into_class and func_path.endswith(".__init__") -%}
8989
{%- set func_path = func_path[:-9] -%}
9090
{%- endif -%}
91-
<autoref identifier="{{ func_path }}({{ param_name }})" optional>{{ param_name }}</autoref>
91+
<autoref identifier="{{ func_path }}({{ param_prefix }}{{ parameter.name }})" optional>{{ parameter.name }}</autoref>
9292
{%- endwith -%}
9393
{%- endfilter -%}
9494
{%- else -%}
95-
{{ param_name }}
95+
{{ parameter.name }}
9696
{%- endif -%}
9797

9898
{#- Render parameter annotation. -#}

0 commit comments

Comments
 (0)