fix: disabling link validation doesn't disable link and reference collection (#659)

Signed-off-by: squidfunk <martin.donath@squidfunk.com>
This commit is contained in:
Martin Donath
2026-05-15 11:38:52 +02:00
committed by GitHub
parent 7a5d97abe0
commit cdee1e8bc7
2 changed files with 24 additions and 3 deletions
+19
View File
@@ -55,6 +55,25 @@ pub struct Validation {
pub invalid_link_anchors: bool,
}
// ----------------------------------------------------------------------------
// Implementations
// ----------------------------------------------------------------------------
impl Validation {
/// Return whether any validation check is enabled.
#[inline]
pub fn is_enabled(&self) -> bool {
self.unresolved_references
|| self.unresolved_footnotes
|| self.unused_definitions
|| self.unused_footnotes
|| self.shadowed_definitions
|| self.shadowed_footnotes
|| self.invalid_links
|| self.invalid_link_anchors
}
}
// ----------------------------------------------------------------------------
// Trait implementations
// ----------------------------------------------------------------------------
+5 -3
View File
@@ -100,9 +100,11 @@ impl Module for Main {
let pages = page.select([wait_for_markdown(&self.config)]);
// Collect all anchors and references from pages, to validate links
let references = collect_references(&files);
let anchors = collect_anchors(&page);
validate(&self.config, self.strict, references, anchors);
if self.config.project.validation.is_enabled() {
let references = collect_references(&files);
let anchors = collect_anchors(&page);
validate(&self.config, self.strict, references, anchors);
}
// Generate navigation and search index
let nav = generate_nav(&self.config, &pages);