Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Provide hook interface, use it to expand identifiers and attach additional context to references #46

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

pawamoy
Copy link
Member

@pawamoy pawamoy commented May 14, 2024

This will allow a few things (some immediately, and some later):

  • immediately: allow handlers to customize how identifiers in references are handled (for example to support relative references, see Parse .-prefixed reference identifiers (relative identifiers) #37)
  • immediately: allow better error messages by providing more context around failed cross-refs
  • immediately (with a bit more thinking & work): allow customizing anchors while retaining full autorefs ability (see Trim anchors crystal#8) actually not relevant
  • later: allow cross-language references (using Sphinx-like domain context)

This PR is the foundation for a follow-up PR in mkdocstrings: mkdocstrings/mkdocstrings#666. The changes over there actually allow handlers to hook into autorefs, while this PR here only provides the contract/interface.

This private PR shows an example hook implementation in mkdocstrings-python Insiders to support relative cross-refs using objects' scope to resolve them.

@pawamoy pawamoy marked this pull request as ready for review May 25, 2024 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant