mkdocstrings / autorefs

Automatically link across pages in MkDocs.
https://mkdocstrings.github.io/autorefs/
ISC License
51 stars 7 forks source link

change: Make failed cross-reference lookup in docstrings clearer #54

Closed pushfoo closed 2 months ago

pushfoo commented 2 months ago

Is your change request related to a problem? Please describe.

When I had a typo in a docstring, the output reported the error as in the markdown file rather than the docstring:

WARNING -  mkdocs_autorefs: api/annotations.md: Could not find cross-reference target
           '[package.oop.annotations]'

Describe the solution you'd like

More detailed / accurate error output which includes:

  1. The docstring file
  2. The item the docstring is on
  3. Docstring line number
  4. Ideally, accurate file line number

Describe alternatives you've considered

N/A?

Additional context

I have:

  1. A package.annotations submodule
  2. A docs/api/annotations file using mkdautodocs (# ::: package.annotations)

The typo was in the package/annotations.py file

pawamoy commented 2 months ago

Thanks for the change request :slightly_smiling_face: It makes a lot of sense, and this is something I've wanted to improve indeed. PR #46 is a first step to make this possible :smile: I'll report progress here :slightly_smiling_face:

pawamoy commented 2 months ago

PR #46 updated to add more context around error, and merged. Expect a release soon :slightly_smiling_face:

pushfoo commented 1 month ago

Just saw this, ty!