feat: add optional slug to public note URLs
This commit is contained in:
9
src/utils/slugify.ts
Normal file
9
src/utils/slugify.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
export function slugify(text: string): string {
|
||||
return text
|
||||
.toLowerCase()
|
||||
.normalize("NFD")
|
||||
.replace(/[\u0300-\u036f]/g, "")
|
||||
.replace(/[^a-z0-9]+/g, "-")
|
||||
.replace(/-+/g, "-")
|
||||
.replace(/^-|-$/g, "")
|
||||
}
|
||||
Reference in New Issue
Block a user