Expand description
Link label normalization (CommonMark’s “matches” relation),
micromark’s normalizeIdentifier equivalence:
value
.replace(/[\t\n\r ]+/g, ' ')
.replace(/^ | $/g, '')
.toLowerCase()
.toUpperCase()Only markdown whitespace collapses (never NBSP / U+3000),
and the fold is lowercase-then-uppercase
(unifies ß/ẞ/SS, σ/ς, ff/FF, which lowercasing alone does not).
The key here is that fold lowercased once more:
it induces the same equivalence (f∘g == f holds for every char, checked exhaustively),
keeps ordinary lowercase labels on the borrowing fast path,
and is exactly the id micromark’s footnote HTML derives (normalizeIdentifier(x).toLowerCase()).
An opaque key for equality, not display text.
Public because resolving reference links from Definition nodes needs
the same normalization the parser used.
Functions§
- normalize
- Borrow-through fast path for labels that are already in key form.