Skip to main content

Module link_parser

Module link_parser 

Source
Expand description

Wiki link parsing, slug generation, and link rewriting.

Handles [[Page Name]] and [[Page Name|alias]] syntax. Uses pulldown-cmark to correctly identify code blocks and inline code spans, so links inside code are reliably ignored.

Structs§

WikiLink
A parsed [[wikilink]] extracted from markdown content.

Functions§

extract_h1
Extract the H1 title from markdown content, if present.
extract_links
Extract all \[\[wikilinks\]\] from markdown content.
replace_wikilinks
Replace all \[\[wikilinks\]\] that resolve to old_slug with new_title. Preserves aliases: [[Old|alias]] -> [[New Title|alias]]. Uses pulldown-cmark to skip links inside code blocks and inline code spans.
slugify
Normalize a page name into a slug.
title_from_slug
Convert a slug back to a title (best-effort reverse of slugify).