-
-
Notifications
You must be signed in to change notification settings - Fork 50
Open
Labels
unconfirmedThis bug was not reproduced yetThis bug was not reproduced yet
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.yml
site_name: Docs
theme:
name: material
plugins:
- autorefs
- mkdocstrings:
handlers:
python:
options:
show_if_no_docstring: true
separate_signature: true
signature_crossrefs: true
- api-autonav:
modules: ["src"]<!-- docs/index.md -->
# Intro# src/__init__.py
class Class:
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
unconfirmedThis bug was not reproduced yetThis bug was not reproduced yet