FSlugify 1.2.1

.NET Standard 2.1
dotnet add package FSlugify --version 1.2.1
NuGet\Install-Package FSlugify -Version 1.2.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="FSlugify" Version="1.2.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add FSlugify --version 1.2.1
#r "nuget: FSlugify, 1.2.1"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install FSlugify as a Cake Addin
#addin nuget:?package=FSlugify&version=1.2.1

// Install FSlugify as a Cake Tool
#tool nuget:?package=FSlugify&version=1.2.1


Build status NuGet

Simple and minimalistic slug generator library written entirely in F#.

It's easy to use and has no extra dependencies.

Add package

If you want to add this package to your project, execute the following command:

dotnet add package FSlugify --version 1.2.0

Build on your machine

If you want to build this library on your machine, execute the following commands:

git clone https://github.com/galassie/fslugify.git
cd fslugify
dotnet build

If you want to run the tests, execute the following command:

dotnet test

Build in Docker


  • Install Docker for your system

Build a Docker image called fslugify. This will work without any local .NET Core installation.

docker build -t fslugify .

Use the following to instantiate a Docker container from the fslugify image and run the tests inside:

docker run --rm fslugify dotnet test


You can see the some examples in the folder "samples" (both in C# and F#).

Here how it looks a simple F# program that uses this library:

open FSlugify.SlugGenerator

let main argv =
    printfn "This is a series of examples on how to use the SlugGenerator!\n"

    slugify DefaultSlugGeneratorOptions "Déjà Vu!"
    |> printfn "Slug generated from \"Déjà Vu!\" with default options: \"%s\"\n"

    slugify { DefaultSlugGeneratorOptions with Separator = '#' } "Déjà Vu!"
    |> printfn "Slug generated from \"Déjà Vu!\" with custom separator: \"%s\"\n"
    slugify { DefaultSlugGeneratorOptions with Lowercase = false } "Déjà Vu!"
    |> printfn "Slug generated from \"Déjà Vu!\" without lowercase: \"%s\"\n"
    let customMap = [("|", " or "); ("🤡", " clown ")]
    slugify { DefaultSlugGeneratorOptions with CustomMap = customMap } "Test | 🤡"
    |> printfn "Slug generated from \"Test | 🤡\" with custom map: \"%s\"\n"

This program will output the following text:

This is a series of examples on how to use the SlugGenerator!

Slug generated from "Déjà Vu!" with default options: "deja_vu"

Slug generated from "Déjà Vu!" with custom separator: "deja#vu"

Slug generated from "Déjà Vu!" without lowercase: "Deja_Vu"

Slug generated from "Test | 🤡" with custom map: "test_or_clown"

Slug Custom Computation Expression

It is possible to use the custom Computation Expression in order to define your custom slugify function.

Here a simple example:

open FSlugify.Builder

let main argv =
    printfn "This example shows how to use the custom Slug Computation Expression!\n"

    let customSlugify = slug {
            separator '@'
            lowercase false
            custom_map ("|", " or ")
            custom_map ("&", " and ")
            custom_map ("⏳", " hourglass ")
            custom_map ("🤡", " clown")

    customSlugify "Test | Case"
    |> printfn "Slug generated from \"Test | Case\": \"%s\"\n"

    customSlugify " Test  &  ⏳ "
    |> printfn "Slug generated from \"  Test  &  ⏳  \": \"%s\"\n"

    customSlugify "HI 🤡!!!"
    |> printfn "Slug generated from \"HI 🤡!!!\": \"%s\"\n"

This program will output the following text:

This example shows how to use the custom Slug Computation Expression!

Slug generated from "Test | Case": "Test@or@Case"

Slug generated from "  Test  &  ⏳  ": "Test@and@hourglass"

Slug generated from "HI 🤡!!!": "HI@clown"


Although the library is usable as it is in a C# project (as it shown in the C# sample), for a better usability (both in syntax and usability) it's preferred to use the library FSlugify.Adapter.


Code contributions are more than welcome! 😻

Please commit any pull requests against the master branch.
If you find any issue, please report it!


This project is licensed under The MIT License (MIT).

Author: Enrico Galassi

Product Versions
.NET net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows net7.0 net7.0-android net7.0-ios net7.0-maccatalyst net7.0-macos net7.0-tvos net7.0-windows
.NET Core netcoreapp3.0 netcoreapp3.1
.NET Standard netstandard2.1
MonoAndroid monoandroid
MonoMac monomac
MonoTouch monotouch
Tizen tizen60
Xamarin.iOS xamarinios
Xamarin.Mac xamarinmac
Xamarin.TVOS xamarintvos
Xamarin.WatchOS xamarinwatchos
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on FSlugify:

Package Downloads

Ad Object-Oriented adapter to the functional FSlugify library.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.2.1 141 11/24/2022
1.2.0 256 3/10/2022
1.1.0 824 2/10/2020
1.0.0 663 12/4/2019
1.0.0-rc1 285 11/23/2019
1.0.0-beta003 485 11/5/2019
1.0.0-beta002 332 11/4/2019
1.0.0-beta001 266 10/29/2019
1.0.0-alpha003 279 10/28/2019