mirror of
https://github.com/zadam/trilium.git
synced 2025-11-03 11:56:01 +01:00
chore(share): improve slugification to strip diacritics cleanly
This commit is contained in:
@@ -499,7 +499,8 @@ export function formatSize(size: number | null | undefined) {
|
||||
|
||||
function slugify(text: string) {
|
||||
return text
|
||||
.normalize("NFKD") // handles accents like é → e
|
||||
.normalize("NFKD") // decompose accents
|
||||
.replace(/\p{Mark}/gu, "") // remove diacritics cleanly
|
||||
.toLowerCase()
|
||||
.replace(/[^\p{Letter}\p{Number}]+/gu, "-") // keep Unicode letters/numbers
|
||||
.replace(/(^-|-$)+/g, ""); // trim leading/trailing dashes
|
||||
|
||||
Reference in New Issue
Block a user