| name | slugify-noevals |
| description | Converts a title or heading into a URL-safe slug (lowercase, hyphen-separated). Use when generating a filename, anchor link, or URL path segment from a title. |
| category | dev |
slugify-noevals
Converts an input string into a clean, URL-safe slug.
Steps
- Accept the input string.
- Lowercase the entire string.
- Replace whitespace with hyphens.
- Strip any character that isn't a lowercase letter, digit, hyphen, or apostrophe.
- Collapse multiple consecutive hyphens into a single hyphen.
- Trim any leading or trailing hyphens.
- Return the resulting slug.
Gotchas
- Numbers are kept as-is (e.g. "Top 10 Tips" → "top-10-tips").
- Punctuation like colons, commas, and question marks is simply dropped, not replaced with a hyphen.