Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 52
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Description of the bug
signature_crossrefs is creating links from local variables used to set instance attributes, where the docs say that it should only be doing it for type annotations.
This becomes a problem if the local variable name matches the name of a heading somewhere else in the docs.
To Reproduce
Setup:
pip install mkdocs-material mkdocs-api-autonav touch mkdocs.yml mkdir docs touch docs/index.md mkdir src touch src/__init__.py# mkdocs.ymlsite_name: Docstheme: name: materialplugins: - autorefs - mkdocstrings: handlers: python: options: show_if_no_docstring: trueseparate_signature: truesignature_crossrefs: true - api-autonav: modules: ["src"]<!-- docs/index.md --># Intro# src/__init__.pyclassClass: def__init__(self): intro="Some text"self.attr=introFinally:
- run
mkdocs serve - open http://127.0.0.1:8000/reference/src/
- notice that:
introhas become a link- that link takes you to http://127.0.0.1:8000/#intro, which is unrelated
Expected behavior
This link should not have been created.
Environment information
- System: macOS-26.1-arm64-arm-64bit
- Python: cpython 3.12.8 (~/.venv/bin/python)
- Environment variables:
- Installed packages:
mkdocstrings-pythonv1.19.0
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working