package slug
Legend:
Library
Module
Module type
Parameter
Class
Class type
Library
Module
Module type
Parameter
Class
Class type
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"
module Charmap : sig ... end
val slugify :
?sep:string ->
?charmap:Charmap.t ->
?lowercase:bool ->
string ->
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
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>