1
0
Fork 0
mirror of https://github.com/avelino/awesome-go.git synced 2024-11-27 11:24:48 -05:00
go/pkg/slug/generator.go
Kirill Zhuravlev b750341e0d
fixme
2023-04-03 08:16:18 -03:00

14 lines
326 B
Go

package slug
import (
"strings"
"github.com/avelino/slugify"
)
// Generate slugs similar to GitHub's slugs on markdown parsing
func Generate(text string) string {
// FIXME: this is should be like regexp.Replace(`[^-a-zA-Z\d]+`, ``)
s := strings.ReplaceAll(text, "/", "")
return slugify.Slugify(strings.TrimSpace(s))
}