From 8a5f94a7570b0c7f83a6f2f455dbd11f5950af74 Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Tue, 17 Dec 2024 09:41:41 -0800 Subject: [PATCH] Fix rule auto-linking on Windows --- mdbook-spec/src/lib.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mdbook-spec/src/lib.rs b/mdbook-spec/src/lib.rs index 27a6d807d..ae614ed69 100644 --- a/mdbook-spec/src/lib.rs +++ b/mdbook-spec/src/lib.rs @@ -98,7 +98,9 @@ impl Spec { .iter() .map(|(rule_id, (_, path))| { let relative = pathdiff::diff_paths(path, current_path).unwrap(); - format!("[{rule_id}]: {}#r-{rule_id}\n", relative.display()) + // Adjust paths for Windows. + let relative = relative.display().to_string().replace('\\', "/"); + format!("[{rule_id}]: {}#r-{rule_id}\n", relative) }) .collect(); format!(