use markdown_link::LinkIndex;
fn main() {
let paths: Vec<String> = [
"notes/plan.md",
"archive/plan.md",
"notes/daily/2026-10-18.md",
"notes/topics/glutes.md",
"img/diagram.png",
]
.map(String::from)
.to_vec();
let index = LinkIndex::build(&paths);
let cases = [
("plan", "notes/daily/2026-10-18.md"), ("notes/plan", "other.md"), ("../plan", "notes/daily/2026-10-18.md"), ("muscle-groups/glutes", "other.md"), ("diagram.png", "other.md"), ("missing", "other.md"),
];
for (target, from) in cases {
println!(
"{target:22} from {from:28} -> {:?}",
index.resolve_from(target, from)
);
}
println!("{} keys, {} collisions", index.len(), index.collisions);
}