Skip to content

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

Merged
pawamoy merged 5 commits intomainfrom
hooks
Sep 1, 2024
Merged

feat: Provide hook interface, use it to expand identifiers and attach additional context to references#46
pawamoy merged 5 commits intomainfrom
hooks

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
@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