-
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: Use the
on_env
hook to fix cross-references
Previously, we used the `on_post_page` hook to fix cross-references. This was problematic because it cornered us to the last per-page event, making it difficult to coordinate ourselves with other plugins such as mkdocstrings. Fixing cross-references must be done once all pages have been rendered to HTML. The earliest we can do that is in `on_env`, which acts as a synchronization barrier here. We coordinate the logic with mkdocstrings thanks to event priorities: autorefs' `on_env` must run after mkdocstrings has finished loading inventories, so that all cross-references can be fixed. Since mkdocstrings uses the default priority, 0, our -50 priority makes us run last. Discussion-mkdocs-3917: mkdocs/mkdocs#3917
- Loading branch information
Showing
2 changed files
with
43 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters