From d57740f874f056fb3ba1c6013ad04227df0f0af8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Mazzucotelli?= Date: Mon, 2 Jun 2025 13:38:20 +0200 Subject: [PATCH 1/3] fix: Only replace CSS class in first *highlighting* span When `pymdownx.highlight` sets `auto_title: true`, another span is rendered before the highlighted code. If we replace its CSS class, we mess its final display. Our solution is not very robust: we only look for spans with CSS classes of 1 or 2 characters instead of 1 or more characters. Issue-281: https://github.com/mkdocstrings/python/issues/281 --- src/mkdocstrings_handlers/python/_internal/rendering.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mkdocstrings_handlers/python/_internal/rendering.py b/src/mkdocstrings_handlers/python/_internal/rendering.py index 902d794..897b657 100644 --- a/src/mkdocstrings_handlers/python/_internal/rendering.py +++ b/src/mkdocstrings_handlers/python/_internal/rendering.py @@ -190,7 +190,7 @@ def do_format_signature( # To fix this, we replace the CSS class in the first span with `nf`, # unless we already found an `nf` span. if not re.search(r'', signature): - signature = re.sub(r'', '', signature, count=1) + signature = re.sub(r'', '', signature, count=1) if stash := env.filters["stash_crossref"].stash: for key, value in stash.items(): From 3c4424d4ff63dacb6e4bf4e7a8c462ea377fb1a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Mazzucotelli?= Date: Tue, 3 Jun 2025 14:52:03 +0200 Subject: [PATCH 2/3] chore: Prepare release 1.16.12 --- CHANGELOG.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b01d34c..ea4f1cf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,14 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## [1.16.12](https://github.com/mkdocstrings/python/releases/tag/1.16.12) - 2025-06-03 + +[Compare with 1.16.11](https://github.com/mkdocstrings/python/compare/1.16.11...1.16.12) + +### Bug Fixes + +- Only replace CSS class in first *highlighting* span ([d57740f](https://github.com/mkdocstrings/python/commit/d57740f874f056fb3ba1c6013ad04227df0f0af8) by Timothée Mazzucotelli). [Issue-281](https://github.com/mkdocstrings/python/issues/281) + ## [1.16.11](https://github.com/mkdocstrings/python/releases/tag/1.16.11) - 2025-05-24 [Compare with 1.16.10](https://github.com/mkdocstrings/python/compare/1.16.10...1.16.11) From bac553d8bd87c2ca9a1cd67fc473e2686a4eedc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Mazzucotelli?= Date: Tue, 3 Jun 2025 15:09:00 +0200 Subject: [PATCH 3/3] ci: Type variable to satisfy Mypy --- src/mkdocstrings_handlers/python/_internal/handler.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mkdocstrings_handlers/python/_internal/handler.py b/src/mkdocstrings_handlers/python/_internal/handler.py index 896a70e..158d7dd 100644 --- a/src/mkdocstrings_handlers/python/_internal/handler.py +++ b/src/mkdocstrings_handlers/python/_internal/handler.py @@ -360,7 +360,7 @@ def get_aliases(self, identifier: str) -> tuple[str, ...]: return tuple(f"{alias}({parameter})" for alias in aliases) return tuple(aliases) - def normalize_extension_paths(self, extensions: Sequence) -> Sequence: + def normalize_extension_paths(self, extensions: Sequence) -> list[str | dict[str, Any]]: """Resolve extension paths relative to config file. Parameters: @@ -369,7 +369,7 @@ def normalize_extension_paths(self, extensions: Sequence) -> Sequence: Returns: The normalized extensions. """ - normalized = [] + normalized: list[str | dict[str, Any]] = [] for ext in extensions: if isinstance(ext, dict):