Coder Social home page Coder Social logo

unicodeslug's Introduction

UnicodeSlug

Permissive slug generator that works with unicode. Port to C#/.NET of https://github.com/jeremys/uslug. Adds support for Korean characters.

Only characters from the Unicode categories Letter, Number and Separator (see Unicode Categories) and the common CJK Unified Ideographs as defined in the version 6.0.0 of the Unicode specification plus the Hangul set.

Quick Examples

using UnicodeSlug;

var slugOptions = new SlugOptions();
slugOptions.GenerateSlug("Быстрее и лучше!"); // "быстрее-и-лучше""
slugOptions.GenerateSlug("汉语/漢語") // "汉语漢語""

var slugOptionsCasing = new SlugOptions 
{
	Lowercase = false
};
var slugOptionsSpaces = new SlugOptions 
{
	Spaces = true
};
var slugOptionsChars = new SlugOptions 
{
	AllowedChars = new [] { '|' }
};
slugOptionsCasing.GenerateSlug("Y U NO") // "Y-U-NO"
slugOptionsSpaces.GenerateSlug("Y U NO") // "y u no"
slugOptionsChars.GenerateSlug("Y-U|NO") // "yu|no"

Installation

From NuGet https://www.nuget.org/packages/unicodeslug

Install-Package UnicodeSlug

Options

  • Public Properties
    • AllowedChars: an array of chars that you want to be whitelisted. Default: '-_~'.
    • Lowercase: a Boolean to force the slug to lowercase. Default: true.
    • Spaces: a Boolean to allow spaces. Default: false.

License

MIT

unicodeslug's People

Contributors

fabslab avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.