mirror of
https://github.com/avelino/awesome-go.git
synced 2024-11-07 16:33:40 +00:00
14 lines
273 B
Go
14 lines
273 B
Go
|
package slug
|
||
|
|
||
|
import (
|
||
|
"strings"
|
||
|
|
||
|
"github.com/avelino/slugify"
|
||
|
)
|
||
|
|
||
|
func Generate(text string) string {
|
||
|
// remove slashes to create slugs similar to GitHub's slugs on markdown parsing
|
||
|
s := strings.ReplaceAll(text, "/", "")
|
||
|
return slugify.Slugify(strings.TrimSpace(s))
|
||
|
}
|