Skip to content

Commit 41a8d5e

Browse files
authored
Set Selectors.strict(::Type{XRefResolvers.Header}) = true (#2787)
1 parent 5084a58 commit 41a8d5e

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1010
* Page category is removed from the search index and now everything is in section category. ([#2762], [#2413])
1111
* Changed the docstring block accordions from a custom implementation to HTML details+summary tag. ([#2772], [#2773])
1212

13+
### Fixed
14+
15+
* Changed the header crossref step to eagerly fail when encountering a non-unique header slug. ([#2668], [#2787])
16+
17+
This is **potentially breaking** and may cause some documentation builds to fail.
18+
Those previously passed but generated incorrect cross-references.
19+
You can fix this by ensuring that you have distinct headers across your markdown pages, or by using the `@id` syntax to give the headers unique slugs.
20+
1321
## Version [v1.15.0] - 2025-10-22
1422

1523
### Changed
@@ -2130,6 +2138,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
21302138
[#2658]: https://github.com/JuliaDocs/Documenter.jl/issues/2658
21312139
[#2659]: https://github.com/JuliaDocs/Documenter.jl/issues/2659
21322140
[#2662]: https://github.com/JuliaDocs/Documenter.jl/issues/2662
2141+
[#2668]: https://github.com/JuliaDocs/Documenter.jl/issues/2668
21332142
[#2674]: https://github.com/JuliaDocs/Documenter.jl/issues/2674
21342143
[#2675]: https://github.com/JuliaDocs/Documenter.jl/issues/2675
21352144
[#2676]: https://github.com/JuliaDocs/Documenter.jl/issues/2676
@@ -2158,6 +2167,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
21582167
[#2772]: https://github.com/JuliaDocs/Documenter.jl/issues/2772
21592168
[#2773]: https://github.com/JuliaDocs/Documenter.jl/issues/2773
21602169
[#2774]: https://github.com/JuliaDocs/Documenter.jl/issues/2774
2170+
[#2787]: https://github.com/JuliaDocs/Documenter.jl/issues/2787
21612171
[JuliaLang/julia#36953]: https://github.com/JuliaLang/julia/issues/36953
21622172
[JuliaLang/julia#38054]: https://github.com/JuliaLang/julia/issues/38054
21632173
[JuliaLang/julia#39841]: https://github.com/JuliaLang/julia/issues/39841

src/cross_references.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,10 @@ module XRefResolvers
161161
after the last step, [`Documenter.xref`](@ref) issues an error that includes any
162162
accumulated error messages from the steps. Failure to resolve an `@ref` link will fail
163163
[`Documenter.makedocs`](@ref) if it is not called with `warnonly=true`.
164+
A step may choose to make the entire pipeline fail when it encounters a case that obviously
165+
has to be resolved by this step, but cannot be resolved due to an error (for example,
166+
a non-unique header slug). In that case, the step should set its [`Selectors.strict`](@ref)
167+
to `true`.
164168
165169
The default pipeline could be extended by plugins using the general [`Selectors`](@ref)
166170
machinery.
@@ -237,6 +241,8 @@ function Selectors.runner(::Type{XRefResolvers.Header}, node, slug, meta, page,
237241
return namedxref(node, slug, meta, page, doc, errors)
238242
end
239243

244+
Selectors.strict(::Type{XRefResolvers.Header}) = true
245+
240246

241247
function Selectors.matcher(::Type{XRefResolvers.Issue}, node, slug, meta, page, doc, errors)
242248
return (xref_unresolved(node) && occursin(r"#[0-9]+", slug))

0 commit comments

Comments
 (0)