From bc12cf44f068f4917111e5cdc60882f0028cda89 Mon Sep 17 00:00:00 2001 From: Christopher Barber Date: Sun, 8 Feb 2026 11:20:29 -0500 Subject: [PATCH 1/2] Fix issue with extended template location (#56) Tested on separate project. Could not immediately reproduce in test project. --- CHANGELOG.md | 4 ++++ pixi.lock | 2 +- src/mkdocstrings_handlers/python_xref/VERSION | 2 +- src/mkdocstrings_handlers/python_xref/handler.py | 7 +++++++ 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 095e997..264fce9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,10 @@ *Note that versions roughly correspond to the version of mkdocstrings-python that they are compatible with.* +## 2.0.1 + +* Fix extended template configuration (#56) + ## 2.0.0 * Depends on mkdocstrings-python >=2.0 and mkdocstrings >=1.0 diff --git a/pixi.lock b/pixi.lock index acefc21..e832fd2 100644 --- a/pixi.lock +++ b/pixi.lock @@ -1776,7 +1776,7 @@ packages: timestamp: 1764784251344 - pypi: ./ name: mkdocstrings-python-xref - version: 2.0.0 + version: 2.0.1 sha256: 484186e584e5e1b652524a054fcd232c06789f38ffb62859fece09124c7c732a requires_dist: - griffe>=1.0 diff --git a/src/mkdocstrings_handlers/python_xref/VERSION b/src/mkdocstrings_handlers/python_xref/VERSION index 227cea2..38f77a6 100644 --- a/src/mkdocstrings_handlers/python_xref/VERSION +++ b/src/mkdocstrings_handlers/python_xref/VERSION @@ -1 +1 @@ -2.0.0 +2.0.1 diff --git a/src/mkdocstrings_handlers/python_xref/handler.py b/src/mkdocstrings_handlers/python_xref/handler.py index 39a7fb0..3ed10cf 100644 --- a/src/mkdocstrings_handlers/python_xref/handler.py +++ b/src/mkdocstrings_handlers/python_xref/handler.py @@ -95,10 +95,17 @@ def render(self, data: CollectorItem, options: PythonOptions, locale: str | None def get_templates_dir(self, handler: Optional[str] = None) -> Path: """See [render][.barf]""" + # use same templates as standard python handler if handler == self.name: handler = 'python' return super().get_templates_dir(handler) + def get_extended_templates_dirs(self, handler: str) -> list[Path]: + # use same templates as standard python handler + if handler == self.name: + handler = 'python' + return super().get_extended_templates_dirs(handler) + def _check_ref(self, ref : str, exclude: list[str | re.Pattern] = []) -> bool: """Check for existence of reference""" for ex in exclude: From 9c911ea9548ab31690bc17328b20c96cd37b7a00 Mon Sep 17 00:00:00 2001 From: Christopher Barber Date: Sun, 8 Feb 2026 11:41:29 -0500 Subject: [PATCH 2/2] Document difference with standard handler (#57) --- docs/index.md | 8 ++++++++ mkdocs.yml | 1 + 2 files changed, 9 insertions(+) diff --git a/docs/index.md b/docs/index.md index 9b582d1..689719c 100644 --- a/docs/index.md +++ b/docs/index.md @@ -5,6 +5,14 @@ fully qualified or is empty, in which case it is taken from the title. If you work with long package and class names or with namespace packages, this can result in a lot of extra typing and harder to read doc-strings. + +!!! note "Difference with mkdocstrings-python" + + [mkdoctrings-python release 1.19](https://github.com/mkdocstrings/python/releases/tag/1.19.0) + introduced support for relative (and also scoped) cross-references, but does not + support the full range of relative syntax supported by this handler. Specifically, + the standard handler only supports the leading `.` syntax described here. + If you enable the `relative_crossrefs` option in the `python_xref` handler options in your mkdocs.yml file ([see configuration](config.md) for an example), then the handler will support more compact relative syntax: diff --git a/mkdocs.yml b/mkdocs.yml index e48a5a4..267703e 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -54,6 +54,7 @@ markdown_extensions: - admonition - pymdownx.snippets: check_paths: true +- pymdownx.details - pymdownx.superfences - pymdownx.tabbed: alternate_style: true