From 832cfdf281624ec78b66ee5e9af21f7384e0b3d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dobros=C5=82aw=20=C5=BBybort?= Date: Mon, 8 Nov 2021 21:10:10 +0100 Subject: [PATCH] Add more info to readme (#62) --- README.md | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 1c594d5..70e495b 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # slug -Package `slug` generate slug from unicode string, URL-friendly slugify with +Package `slug` generate slug from Unicode string, URL-friendly slugify with multiple languages support. [![Go Reference](https://pkg.go.dev/badge/github.com/gosimple/slug.svg)](https://pkg.go.dev/github.com/gosimple/slug) @@ -43,10 +43,34 @@ func main() { } ``` -### Requests or bugs? +## Design + +This library will always returns clean output from any Unicode string +containing only the following ASCII characters: + +* numbers: `0-9` +* small letters: `a-z` +* big letters: `A-Z` (only if you set `Lowercase` to `false`) +* minus sign: `-` +* underscore: `_` + +Minus sign and underscore characters will never appear at the beginning or +the end of the returned string. + +Thanks to context-insensitive transliteration of Unicode characters to ASCII +output returned string is safe for URL slugs and filenames. + +## Requests or bugs? +If your language is missing you could add it in `languages_substitution.go` +file. + +In case of missing proper Unicode characters transliteration to ASCII you could +add them to underlying library: +. + ## Installation ```shell