Skip to content

Commit 0334131

Browse files
committed
fix: Always display attribute values as they're written in the source
Issue-311: #311
1 parent 39311c7 commit 0334131

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

src/mkdocstrings_handlers/python/_internal/rendering.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,13 @@ def do_format_attribute(
245245
)
246246
signature += f": {annotation}"
247247
if show_value and attribute.value:
248-
value = template.render(context.parent, expression=attribute.value, signature=True, backlink_type="used-by")
248+
value = template.render(
249+
context.parent,
250+
expression=attribute.value,
251+
signature=True,
252+
annotations_path="source",
253+
backlink_type="used-by",
254+
)
249255
signature += f" = {value}"
250256

251257
signature = do_format_code(signature, line_length)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,4 +169,4 @@ Context:
169169
{%- if config.modernize_annotations and expression is not string -%}
170170
{%- set expression = expression.modernize() -%}
171171
{%- endif -%}
172-
{{ render(expression, config.annotations_path, backlink_type|default("")) }}
172+
{{ render(expression, annotations_path|default(config.annotations_path), backlink_type|default("")) }}

0 commit comments

Comments
 (0)