improve slugify function

This commit is contained in:
Ell 2023-09-25 22:37:38 +02:00
parent b680280ee3
commit fb6094a1b8

View file

@ -48,7 +48,8 @@
ariaHidden: true ariaHidden: true
}), }),
// prepend current file id to the anchor permalink // prepend current file id to the anchor permalink
slugify: s => `${getId() ?? ""}-${encodeURIComponent(String(s).trim().toLowerCase().replace(/\s+/g, "-").replace(/[^A-Za-z0-9_-]/g, ""))}` slugify: s => `${getId() ?? ""}-${encodeURIComponent(String(s).trim().toLowerCase().normalize("NFKD").replace(/\p{M}/g, "").replace(/\s+/g, "-").replace(/[^a-z0-9_-]/g, "")
)}`
}); });
md.use(markdownitFootnote); md.use(markdownitFootnote);