diff --git a/pyproject.toml b/pyproject.toml index f1ff7334..0eccf7fe 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -29,8 +29,8 @@ classifiers = [ "Typing :: Typed", ] dependencies = [ - "mkdocstrings>=0.25", - "mkdocs-autorefs>=1.0", + "mkdocstrings>=0.26", + "mkdocs-autorefs>=1.2", "griffe>=0.49", ] diff --git a/src/mkdocstrings_handlers/python/handler.py b/src/mkdocstrings_handlers/python/handler.py index a4a5b47c..eb1d73c7 100644 --- a/src/mkdocstrings_handlers/python/handler.py +++ b/src/mkdocstrings_handlers/python/handler.py @@ -426,6 +426,7 @@ def update_env(self, md: Markdown, config: dict) -> None: self.env.filters["as_functions_section"] = rendering.do_as_functions_section self.env.filters["as_classes_section"] = rendering.do_as_classes_section self.env.filters["as_modules_section"] = rendering.do_as_modules_section + self.env.globals["AutorefsHook"] = rendering.AutorefsHook self.env.tests["existing_template"] = lambda template_name: template_name in self.env.list_templates() def get_anchors(self, data: CollectorItem) -> tuple[str, ...]: # noqa: D102 (ignore missing docstring) diff --git a/src/mkdocstrings_handlers/python/rendering.py b/src/mkdocstrings_handlers/python/rendering.py index d5a88699..2c4a4893 100644 --- a/src/mkdocstrings_handlers/python/rendering.py +++ b/src/mkdocstrings_handlers/python/rendering.py @@ -22,6 +22,7 @@ ) from jinja2 import TemplateNotFound, pass_context, pass_environment from markupsafe import Markup +from mkdocs_autorefs.references import AutorefsHookInterface from mkdocstrings.loggers import get_logger if TYPE_CHECKING: @@ -571,3 +572,60 @@ def do_as_modules_section( A modules docstring section. """ return DocstringSectionModules([]) + + +class AutorefsHook(AutorefsHookInterface): + """Autorefs hook. + + With this hook, we're able to add context to autorefs (cross-references), + such as originating file path and line number, to improve error reporting. + """ + + def __init__(self, current_object: Object | Alias, config: dict[str, Any]) -> None: + """Initialize the hook. + + Parameters: + current_object: The object being rendered. + config: The configuration dictionary. + """ + self.current_object = current_object + self.config = config + + def expand_identifier(self, identifier: str) -> str: + """Expand an identifier. + + Parameters: + identifier: The identifier to expand. + + Returns: + The expanded identifier. + """ + return identifier + + def get_context(self) -> AutorefsHookInterface.Context: + """Get the context for the current object. + + Returns: + The context. + """ + role = { + "attribute": "data" if self.current_object.parent and self.current_object.parent.is_module else "attr", + "class": "class", + "function": "meth" if self.current_object.parent and self.current_object.parent.is_class else "func", + "module": "mod", + }.get(self.current_object.kind.value.lower(), "obj") + origin = self.current_object.path + try: + filepath = self.current_object.docstring.parent.filepath # type: ignore[union-attr] + lineno = self.current_object.docstring.lineno or 0 # type: ignore[union-attr] + except AttributeError: + filepath = self.current_object.filepath + lineno = 0 + + return AutorefsHookInterface.Context( + domain="py", + role=role, + origin=origin, + filepath=str(filepath), + lineno=lineno, + ) diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/docstring.html.jinja index bc561b14..14d11d03 100644 --- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring.html.jinja +++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring.html.jinja @@ -19,35 +19,37 @@ Context: -#} {{ log.debug("Rendering docstring") }} {% endblock logs %} - {% for section in docstring_sections %} - {% if config.show_docstring_description and section.kind.value == "text" %} - {{ section.value|convert_markdown(heading_level, html_id) }} - {% elif config.show_docstring_attributes and section.kind.value == "attributes" %} - {% include "docstring/attributes"|get_template with context %} - {% elif config.show_docstring_functions and section.kind.value == "functions" %} - {% include "docstring/functions"|get_template with context %} - {% elif config.show_docstring_classes and section.kind.value == "classes" %} - {% include "docstring/classes"|get_template with context %} - {% elif config.show_docstring_modules and section.kind.value == "modules" %} - {% include "docstring/modules"|get_template with context %} - {% elif config.show_docstring_parameters and section.kind.value == "parameters" %} - {% include "docstring/parameters"|get_template with context %} - {% elif config.show_docstring_other_parameters and section.kind.value == "other parameters" %} - {% include "docstring/other_parameters"|get_template with context %} - {% elif config.show_docstring_raises and section.kind.value == "raises" %} - {% include "docstring/raises"|get_template with context %} - {% elif config.show_docstring_warns and section.kind.value == "warns" %} - {% include "docstring/warns"|get_template with context %} - {% elif config.show_docstring_yields and section.kind.value == "yields" %} - {% include "docstring/yields"|get_template with context %} - {% elif config.show_docstring_receives and section.kind.value == "receives" %} - {% include "docstring/receives"|get_template with context %} - {% elif config.show_docstring_returns and section.kind.value == "returns" %} - {% include "docstring/returns"|get_template with context %} - {% elif config.show_docstring_examples and section.kind.value == "examples" %} - {% include "docstring/examples"|get_template with context %} - {% elif config.show_docstring_description and section.kind.value == "admonition" %} - {% include "docstring/admonition"|get_template with context %} - {% endif %} - {% endfor %} + {% with autoref_hook = AutorefsHook(obj, config) %} + {% for section in docstring_sections %} + {% if config.show_docstring_description and section.kind.value == "text" %} + {{ section.value|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }} + {% elif config.show_docstring_attributes and section.kind.value == "attributes" %} + {% include "docstring/attributes"|get_template with context %} + {% elif config.show_docstring_functions and section.kind.value == "functions" %} + {% include "docstring/functions"|get_template with context %} + {% elif config.show_docstring_classes and section.kind.value == "classes" %} + {% include "docstring/classes"|get_template with context %} + {% elif config.show_docstring_modules and section.kind.value == "modules" %} + {% include "docstring/modules"|get_template with context %} + {% elif config.show_docstring_parameters and section.kind.value == "parameters" %} + {% include "docstring/parameters"|get_template with context %} + {% elif config.show_docstring_other_parameters and section.kind.value == "other parameters" %} + {% include "docstring/other_parameters"|get_template with context %} + {% elif config.show_docstring_raises and section.kind.value == "raises" %} + {% include "docstring/raises"|get_template with context %} + {% elif config.show_docstring_warns and section.kind.value == "warns" %} + {% include "docstring/warns"|get_template with context %} + {% elif config.show_docstring_yields and section.kind.value == "yields" %} + {% include "docstring/yields"|get_template with context %} + {% elif config.show_docstring_receives and section.kind.value == "receives" %} + {% include "docstring/receives"|get_template with context %} + {% elif config.show_docstring_returns and section.kind.value == "returns" %} + {% include "docstring/returns"|get_template with context %} + {% elif config.show_docstring_examples and section.kind.value == "examples" %} + {% include "docstring/examples"|get_template with context %} + {% elif config.show_docstring_description and section.kind.value == "admonition" %} + {% include "docstring/admonition"|get_template with context %} + {% endif %} + {% endfor %} + {% endwith %} {% endif %} diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/admonition.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/admonition.html.jinja index 70f462db..ff6e9cbc 100644 --- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/admonition.html.jinja +++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/admonition.html.jinja @@ -15,6 +15,6 @@ Context: {% endblock logs %}
- {{ section.title|convert_markdown(heading_level, html_id, strip_paragraph=True) }} - {{ section.value.contents|convert_markdown(heading_level, html_id) }} + {{ section.title|convert_markdown(heading_level, html_id, strip_paragraph=True, autoref_hook=autoref_hook) }} + {{ section.value.contents|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/attributes.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/attributes.html.jinja index 34aa0119..0bb416e0 100644 --- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/attributes.html.jinja +++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/attributes.html.jinja @@ -43,7 +43,7 @@ Context:
- {{ attribute.description|convert_markdown(heading_level, html_id) }} + {{ attribute.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }}
@@ -66,7 +66,7 @@ Context: {% endif %} –
- {{ attribute.description|convert_markdown(heading_level, html_id) }} + {{ attribute.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }}
{% endfor %} @@ -88,7 +88,7 @@ Context: {{ attribute.name }}
- {{ attribute.description|convert_markdown(heading_level, html_id) }} + {{ attribute.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }}

{% if attribute.annotation %} diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/classes.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/classes.html.jinja index a3b494c9..82bae98c 100644 --- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/classes.html.jinja +++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/classes.html.jinja @@ -35,7 +35,7 @@ Context: {{ class.name }}

- {{ class.description|convert_markdown(heading_level, html_id) }} + {{ class.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }}
@@ -53,7 +53,7 @@ Context: {{ class.name }}
- {{ class.description|convert_markdown(heading_level, html_id) }} + {{ class.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }}
{% endfor %} @@ -75,7 +75,7 @@ Context: {{ class.name }}
- {{ class.description|convert_markdown(heading_level, html_id) }} + {{ class.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/examples.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/examples.html.jinja index 39a90fa0..dd0b503f 100644 --- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/examples.html.jinja +++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/examples.html.jinja @@ -21,7 +21,7 @@ Context:

{{ section.title or lang.t("Examples:") }}

{% for section_type, sub_section in section.value %} {% if section_type.value == "text" %} - {{ sub_section|convert_markdown(heading_level, html_id) }} + {{ sub_section|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }} {% elif section_type.value == "examples" %} {{ sub_section|highlight(language="pycon", linenums=False) }} {% endif %} diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/functions.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/functions.html.jinja index efaf9a37..f979f4e5 100644 --- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/functions.html.jinja +++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/functions.html.jinja @@ -36,7 +36,7 @@ Context: {{ function.name }}
- {{ function.description|convert_markdown(heading_level, html_id) }} + {{ function.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }}
@@ -56,7 +56,7 @@ Context: {{ function.name }}
- {{ function.description|convert_markdown(heading_level, html_id) }} + {{ function.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }}
{% endif %} @@ -80,7 +80,7 @@ Context: {{ function.name }}
- {{ function.description|convert_markdown(heading_level, html_id) }} + {{ function.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/modules.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/modules.html.jinja index caec690f..b18e69f0 100644 --- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/modules.html.jinja +++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/modules.html.jinja @@ -35,7 +35,7 @@ Context: {{ module.name }}
- {{ module.description|convert_markdown(heading_level, html_id) }} + {{ module.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }}
@@ -53,7 +53,7 @@ Context: {{ module.name }}
- {{ module.description|convert_markdown(heading_level, html_id) }} + {{ module.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }}
{% endfor %} @@ -75,7 +75,7 @@ Context: {{ module.name }}
- {{ module.description|convert_markdown(heading_level, html_id) }} + {{ module.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/other_parameters.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/other_parameters.html.jinja index a8730966..24c6b194 100644 --- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/other_parameters.html.jinja +++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/other_parameters.html.jinja @@ -43,7 +43,7 @@ Context:
- {{ parameter.description|convert_markdown(heading_level, html_id) }} + {{ parameter.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }}
@@ -66,7 +66,7 @@ Context: {% endif %} –
- {{ parameter.description|convert_markdown(heading_level, html_id) }} + {{ parameter.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }}
{% endfor %} @@ -88,7 +88,7 @@ Context: {{ parameter.name }}
- {{ parameter.description|convert_markdown(heading_level, html_id) }} + {{ parameter.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }}

{% if parameter.annotation %} diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/parameters.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/parameters.html.jinja index a2db4900..8b0556f3 100644 --- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/parameters.html.jinja +++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/parameters.html.jinja @@ -44,7 +44,7 @@ Context:

- {{ parameter.description|convert_markdown(heading_level, html_id) }} + {{ parameter.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }}
@@ -81,7 +81,7 @@ Context: {% endif %} –
- {{ parameter.description|convert_markdown(heading_level, html_id) }} + {{ parameter.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }}
{% endfor %} @@ -103,7 +103,7 @@ Context: {{ parameter.name }}
- {{ parameter.description|convert_markdown(heading_level, html_id) }} + {{ parameter.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }}

{% if parameter.annotation %} diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/raises.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/raises.html.jinja index 21490f4e..f796494b 100644 --- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/raises.html.jinja +++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/raises.html.jinja @@ -41,7 +41,7 @@ Context:

- {{ raises.description|convert_markdown(heading_level, html_id) }} + {{ raises.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }}
@@ -63,7 +63,7 @@ Context: – {% endif %}
- {{ raises.description|convert_markdown(heading_level, html_id) }} + {{ raises.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }}
{% endfor %} @@ -91,7 +91,7 @@ Context:
- {{ raises.description|convert_markdown(heading_level, html_id) }} + {{ raises.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/receives.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/receives.html.jinja index 86420b39..57df473f 100644 --- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/receives.html.jinja +++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/receives.html.jinja @@ -44,7 +44,7 @@ Context:
- {{ receives.description|convert_markdown(heading_level, html_id) }} + {{ receives.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }}
@@ -69,7 +69,7 @@ Context: {% endif %} –
- {{ receives.description|convert_markdown(heading_level, html_id) }} + {{ receives.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }}
{% endfor %} @@ -101,7 +101,7 @@ Context:
- {{ receives.description|convert_markdown(heading_level, html_id) }} + {{ receives.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }}
{% if receives.name and receives.annotation %}

diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/returns.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/returns.html.jinja index d402369a..cab2ca77 100644 --- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/returns.html.jinja +++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/returns.html.jinja @@ -44,7 +44,7 @@ Context:

- {{ returns.description|convert_markdown(heading_level, html_id) }} + {{ returns.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }}
@@ -69,7 +69,7 @@ Context: {% endif %} –
- {{ returns.description|convert_markdown(heading_level, html_id) }} + {{ returns.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }}
{% endfor %} @@ -101,7 +101,7 @@ Context:
- {{ returns.description|convert_markdown(heading_level, html_id) }} + {{ returns.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }}
{% if returns.name and returns.annotation %}

diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/warns.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/warns.html.jinja index 702b9351..a892244a 100644 --- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/warns.html.jinja +++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/warns.html.jinja @@ -41,7 +41,7 @@ Context:

- {{ warns.description|convert_markdown(heading_level, html_id) }} + {{ warns.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }}
@@ -63,7 +63,7 @@ Context: – {% endif %}
- {{ warns.description|convert_markdown(heading_level, html_id) }} + {{ warns.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }}
{% endfor %} @@ -91,7 +91,7 @@ Context:
- {{ warns.description|convert_markdown(heading_level, html_id) }} + {{ warns.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/yields.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/yields.html.jinja index c83c478b..96c373dd 100644 --- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/yields.html.jinja +++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/yields.html.jinja @@ -44,7 +44,7 @@ Context:
- {{ yields.description|convert_markdown(heading_level, html_id) }} + {{ yields.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }}
@@ -69,7 +69,7 @@ Context: {% endif %} –
- {{ yields.description|convert_markdown(heading_level, html_id) }} + {{ yields.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }}
{% endfor %} @@ -101,7 +101,7 @@ Context:
- {{ yields.description|convert_markdown(heading_level, html_id) }} + {{ yields.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }}
{% if yields.name and yields.annotation %}

diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/attributes.html.jinja b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/attributes.html.jinja index f02e0b9c..8df3f9f3 100644 --- a/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/attributes.html.jinja +++ b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/attributes.html.jinja @@ -38,7 +38,7 @@ Context: {% endif %} –

- {{ attribute.description|convert_markdown(heading_level, html_id) }} + {{ attribute.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }}
{% endfor %} diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/other_parameters.html.jinja b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/other_parameters.html.jinja index 34264133..287bbf3d 100644 --- a/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/other_parameters.html.jinja +++ b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/other_parameters.html.jinja @@ -38,7 +38,7 @@ Context: {% endif %} –
- {{ parameter.description|convert_markdown(heading_level, html_id) }} + {{ parameter.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }}
{% endfor %} diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/parameters.html.jinja b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/parameters.html.jinja index 369912e7..da30d60a 100644 --- a/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/parameters.html.jinja +++ b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/parameters.html.jinja @@ -43,7 +43,7 @@ Context: {% endif %} –
- {{ parameter.description|convert_markdown(heading_level, html_id) }} + {{ parameter.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }}
{% endfor %} diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/raises.html.jinja b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/raises.html.jinja index 43d134f8..ffa3fad1 100644 --- a/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/raises.html.jinja +++ b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/raises.html.jinja @@ -37,7 +37,7 @@ Context: {% endif %} –
- {{ raises.description|convert_markdown(heading_level, html_id) }} + {{ raises.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }}
{% endfor %} diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/receives.html.jinja b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/receives.html.jinja index 636c17e4..40c77846 100644 --- a/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/receives.html.jinja +++ b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/receives.html.jinja @@ -40,7 +40,7 @@ Context: {% endif %} –
- {{ receives.description|convert_markdown(heading_level, html_id) }} + {{ receives.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }}
{% endfor %} diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/returns.html.jinja b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/returns.html.jinja index a00732d9..597d8932 100644 --- a/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/returns.html.jinja +++ b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/returns.html.jinja @@ -40,7 +40,7 @@ Context: {% endif %} –
- {{ returns.description|convert_markdown(heading_level, html_id) }} + {{ returns.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }}
{% endfor %} diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/warns.html.jinja b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/warns.html.jinja index b445639c..d66ac431 100644 --- a/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/warns.html.jinja +++ b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/warns.html.jinja @@ -37,7 +37,7 @@ Context: {% endif %} –
- {{ warns.description|convert_markdown(heading_level, html_id) }} + {{ warns.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }}
{% endfor %} diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/yields.html.jinja b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/yields.html.jinja index 91097828..4d4fc3d5 100644 --- a/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/yields.html.jinja +++ b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/yields.html.jinja @@ -40,7 +40,7 @@ Context: {% endif %} –
- {{ yields.description|convert_markdown(heading_level, html_id) }} + {{ yields.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }}
{% endfor %}