1
0
Fork 0
mirror of https://github.com/avelino/awesome-go.git synced 2024-10-30 12:04:12 -04:00
go/pkg/slug/generator.go
Benjamin Schoch 85cd71ec7d code style
2022-09-19 06:44:12 -03:00

13 lines
256 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 {
s := strings.ReplaceAll(text, "/", "")
return slugify.Slugify(strings.TrimSpace(s))
}