Skip to content

Commit 4ab180d

Browse files
committed
fix: Renew MkDocs' relpath processor instead of using same instance
Issue-mkdocs-3919: mkdocs/mkdocs#3919
1 parent ede1941 commit 4ab180d

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/mkdocstrings/handlers/base.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,9 @@ def _update_env(self, md: Markdown, *, config: Any | None = None) -> None:
523523

524524
# MkDocs adds its own (required) extension that's not part of the config. Propagate it.
525525
if "relpath" in md.treeprocessors:
526-
new_md.treeprocessors.register(md.treeprocessors["relpath"], "relpath", priority=0)
526+
relpath = md.treeprocessors["relpath"]
527+
new_relpath = type(relpath)(relpath.file, relpath.files, relpath.config) # type: ignore[attr-defined,call-arg]
528+
new_md.treeprocessors.register(new_relpath, "relpath", priority=0)
527529

528530
self._md = new_md
529531

0 commit comments

Comments
 (0)