Packages

The library Slugger can generate slugs from given strings that can be used in URLs or file names.

Current section

Files

Jump to
slugger lib slugify.ex
Raw

lib/slugify.ex

defprotocol Slugify do
@moduledoc "The Slugify protocol can be used to enable slugs for own data structures."
@fallback_to_any true
@doc "Returns the slug for the given data."
def slugify(data)
end
defimpl Slugify, for: Any do
@doc "Default handler for anything that implements String.Chars Protocol."
def slugify(data), do: Slugger.slugify(Kernel.to_string data)
end