Skip to main content

Module slugger

Module slugger 

Source
Expand description

GitHub-style heading-anchor slug generator.

Mirrors github-slugger (the npm package used by rehype-slug): lowercase, drop ASCII punctuation/symbols, drop control chars, replace whitespace runs with -, collapse repeated -, trim. Punctuation is stripped (NOT replaced), so 0.4.3 -> 043, It's -> its - matching velite output.

For dedupe (#patch-changes, #patch-changes-1, #patch-changes-2) use Slugger, which threads a count map across one document’s headings.

Structs§

Slugger
Document-scoped slugger. Tracks how many times each base slug has already been emitted; collisions get a -1, -2, … suffix.

Functions§

github_slugify
Compute the GitHub-style slug for a single heading, ignoring dedupe. For document-wide dedupe, use Slugger::slug.