Module: RedQuilt::Slug
- Defined in:
- lib/red_quilt/slug.rb
Overview
Heading-anchor slugs, following GitHub’s github-slugger approach: downcase, strip punctuation, spaces to hyphens – but keep Unicode letters/marks/numbers verbatim, so Japanese (and other non-ASCII) headings survive instead of collapsing to empty ids.
Defined Under Namespace
Classes: Counter
Constant Summary collapse
- STRIP_RE =
Drop anything that is not a letter, mark, number, underscore, space, or hyphen. Browsers percent-encode non-ASCII fragment ids on the wire but resolve and display them fine, matching GitHub.
/[^\p{L}\p{M}\p{N}_ -]+/u- SPACE_RE =
/ +/