summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/util/path_display.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/util/path_display.rs b/src/util/path_display.rs
index e9dca4b..d7bd624 100644
--- a/src/util/path_display.rs
+++ b/src/util/path_display.rs
@@ -1,5 +1,12 @@
+//! Path display helpers.
+
use std::path::Path;
+/// Converts a path to a Markdown-friendly display string.
+///
+/// This uses Rust's debug path formatting, then strips surrounding quotes when present. That keeps
+/// escaped characters such as newlines and invalid UTF-8 markers visible in generated Markdown
+/// headings.
pub fn display_path(path: &Path) -> String {
let s = format!("{:?}", path);
s.strip_prefix('"')