Skip to main content

normalize_target

Function normalize_target 

Source
pub fn normalize_target(raw: &str) -> String
Expand description

Normalise a link target to an index key.

This is the crate’s only place a .md extension is stripped, running on both path suffixes at build time and queries at resolve time. Stripping elsewhere strips a second .md extension, doubling it.

§Examples

use markdown_link::normalize_target;

assert_eq!(normalize_target("./Notes//A%20B.MD"), "notes/a b");
assert_eq!(normalize_target("  dir\\file  "), "dir/file");