From c4506f080e0c75cd32d6512c80f5016e82fc12bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Mazzucotelli?= Date: Thu, 19 Dec 2024 17:51:29 +0100 Subject: [PATCH] refactor: Render `*` and `**` outside of cross-references in signatures Needed-for-PR-216: https://github.com/mkdocstrings/python/pull/216 --- .../templates/material/_base/signature.html.jinja | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/signature.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/signature.html.jinja index 641b8b8..750cac3 100644 --- a/src/mkdocstrings_handlers/python/templates/material/_base/signature.html.jinja +++ b/src/mkdocstrings_handlers/python/templates/material/_base/signature.html.jinja @@ -72,27 +72,27 @@ Context: {%- endif -%} {#- Prepare name. -#} - {%- set param_name -%} + {%- set param_prefix -%} {%- if parameter.kind.value == "variadic positional" -%} * {%- elif parameter.kind.value == "variadic keyword" -%} ** {%- endif -%} - {{ parameter.name }} {%- endset -%} {#- Render parameter name with optional cross-reference to its heading. -#} + {{ param_prefix }} {%- if config.separate_signature and config.parameter_headings and config.signature_crossrefs -%} - {%- filter stash_crossref(length=param_name|length) -%} + {%- filter stash_crossref(length=parameter.name|length) -%} {%- with func_path = function.path -%} {%- if config.merge_init_into_class and func_path.endswith(".__init__") -%} {%- set func_path = func_path[:-9] -%} {%- endif -%} - {{ param_name }} + {{ parameter.name }} {%- endwith -%} {%- endfilter -%} {%- else -%} - {{ param_name }} + {{ parameter.name }} {%- endif -%} {#- Render parameter annotation. -#}