Turning a title into something safe for a URL path, a filename or an anchor
comes up in every project that publishes anything, and the hand-rolled versions
tend to leave a trailing hyphen or let a stray character through. The repo
already has FilterToAlnum, which throws separators away entirely, so a
function that keeps word boundaries as hyphens is a natural companion.
Definition of done: Slugify(input string) string returns a string of
lowercase ASCII letters, digits and single hyphens, where every run of other
characters becomes one hyphen and there are no hyphens at the start or end. It
has a doc comment and table-driven tests covering mixed case, punctuation, runs
of separators, leading and trailing separators, a string with nothing usable in
it, an empty string, and text outside ASCII.
Model: opus-5
Turning a title into something safe for a URL path, a filename or an anchor
comes up in every project that publishes anything, and the hand-rolled versions
tend to leave a trailing hyphen or let a stray character through. The repo
already has `FilterToAlnum`, which throws separators away entirely, so a
function that keeps word boundaries as hyphens is a natural companion.
Definition of done: `Slugify(input string) string` returns a string of
lowercase ASCII letters, digits and single hyphens, where every run of other
characters becomes one hyphen and there are no hyphens at the start or end. It
has a doc comment and table-driven tests covering mixed case, punctuation, runs
of separators, leading and trailing separators, a string with nothing usable in
it, an empty string, and text outside ASCII.
Model: opus-5
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Turning a title into something safe for a URL path, a filename or an anchor
comes up in every project that publishes anything, and the hand-rolled versions
tend to leave a trailing hyphen or let a stray character through. The repo
already has
FilterToAlnum, which throws separators away entirely, so afunction that keeps word boundaries as hyphens is a natural companion.
Definition of done:
Slugify(input string) stringreturns a string oflowercase ASCII letters, digits and single hyphens, where every run of other
characters becomes one hyphen and there are no hyphens at the start or end. It
has a doc comment and table-driven tests covering mixed case, punctuation, runs
of separators, leading and trailing separators, a string with nothing usable in
it, an empty string, and text outside ASCII.
Model: opus-5