Skip to main content

links

Function links 

Source
pub fn links(body: &str) -> Vec<Link>
Expand description

Extract Markdown [text](target) cross-links from body, skipping external URLs (http(s)://, mailto:) and bare anchors (#…). The kind of relationship is conveyed by prose, not syntax, so links are untyped edges.

§Examples

use coding_tools::okf::links;

let body = "see [customers](/tables/customers.md) and [home](https://x.test)\n";
let ls = links(body);
assert_eq!(ls.len(), 1);
assert_eq!(ls[0].target, "/tables/customers.md");
assert!(ls[0].absolute);