slug-preserve
Case-preserving slugifier with Unicode support.
Unlike most Rust slug crates (including the popular slug crate) which always
lowercase, slug-preserve lets you choose how case is handled via CaseMode.
Usage
use ;
// Preserve original case (default)
let opts = default;
assert_eq!;
// Lowercase
let opts = SlugOpts ;
assert_eq!;
// Title case
let opts = SlugOpts ;
assert_eq!;
Case modes
CaseMode |
Effect |
|---|---|
Preserve |
Keep original character case (default) |
Lower |
Lowercase everything |
Upper |
Uppercase everything |
Title |
First char of each word upper, rest lower |
Capitalize |
Alias for Title |
Notes
- Input is NFKC-normalized before slugifying.
- Non-alphanumeric characters become the separator; runs collapse to one.
- Leading/trailing separators are trimmed from output.
split_camelonSlugOptsis carried through but not acted on by this crate - callers (likefren-date) split CamelCase before callingslugify.
License
MIT - see LICENSE in the workspace root.