//! Helpers for displaying filesystem paths in generated Markdown. use std::path::Path; /// Converts a path to a Markdown-friendly display string. /// /// The returned string uses Rust's debug-style path formatting so that unusual characters remain /// visible instead of affecting the Markdown structure. For example, embedded newlines are shown as /// `\n`, and invalid UTF-8 bytes are escaped. /// /// Surrounding quotes added by debug formatting are stripped when present, so ordinary paths remain /// easy to read. pub fn display_path(path: &Path) -> String { let s = format!("{:?}", path); s.strip_prefix('"') .and_then(|s| s.strip_suffix('"')) .unwrap_or(&s) .to_string() }