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

Merged
merged 5 commits into from
Sep 1, 2024

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 merged commit fb8df98 into main Sep 1, 2024
51 checks passed
@pawamoy pawamoy deleted the hooks branch September 1, 2024 17:33
pawamoy added a commit to mkdocstrings/mkdocstrings that referenced this pull request Sep 1, 2024
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.

1 participant