unicode-slugs
Build URL slugs from titles that may contain accents, punctuation or repeated separators. Use when writing or fixing a slugify function.
Files2
View on GitHubSKILL.mdpackages/sigil/test/fixtures/lab/catalog/skills/sample/unicode-slugs/SKILL.md
GitHubUnicode-safe slugs
- Normalize with
String.prototype.normalize('NFKD')so accented letters split into a base letter and combining marks. - Remove the combining marks:
.replace(/[̀-ͯ]/g, ''). - Lowercase, then replace every run of characters that are not
a-zor0-9with one hyphen. - Trim hyphens from both ends.
- Run the project's tests before saying you are done.