package slug
Module SlugSource
Generate url safe slug from a string Data and general algorithm is taken from https://github.com/simov/slugify
This library assumes all strings are UTF-8. General algorithm:
- Normalize input string with NFC (compose form)
- Replace special characters that isn't url safe with a custom char map
- Remove all non alphabets and numbers characters
- Replace all whitespaces with
sep
Example:
let vi = Charmap.mk_charmap [Slug_data.base; Slug_data.vi]
let my_slug = slugify ~charmap: vi "my string"slugify ?sep ?charmap ?lowercase string generates slug from string by replacing whitespaces with sep and replacement characters from charmap
sep defaults to "-" charmap defaults to Charmap.base lowercase defaults to true