docs: add stable anchors and cross-ref ids to guide pages - #555
Merged
Merged
Conversation
Add an `@id guide-<slug>` anchor to every guide page H1 and convert cross-guide references (both relative `.md` links and bare `@ref` links) to the new `@ref guide-<slug>` ids. This fixes a broken `[Differentiation](@ref)` link that produced an unresolvable `./@ref` dead link and failed the Vitepress docs build in CI. The ids also give external pages a stable target for cross-referencing. Move the `@meta` block after the H1 so guide pages satisfy the markdownlint MD041 (first-line-heading) rule.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Scope
Add a stable
@id guide-<slug>anchor to the H1 of every docs guide page and convert all cross-guide references to the new ids:[Data](data.md)→[Data](@ref guide-data)@refs like[Options System](@ref)→[Options System](@ref guide-options-system)@metablock after the H1 on the 7 pages where it preceded the title, to satisfy markdownlint MD041 (first-line-heading).Motivation
The docs build failed in CI because
[Differentiation](@ref)could not be resolved:differentiation.md's heading isDifferentiation: AD backend strategies, so there is no anchor namedDifferentiation. The unresolved@refrenders as a literal./@reflink, which Vitepress treats as a dead link and aborts the build.Giving every page a named
@idmakes such references robust and provides a stable target for external (InterLinks) cross-references.Verification
julia --project=. docs/make.jlbuilds cleanly with noCannot resolve @refwarnings and no dead links.Closes #554.