better slugify

This commit is contained in:
Ell 2023-08-17 14:31:55 +02:00
parent 8437518451
commit 7337feeab6

View file

@ -47,7 +47,7 @@
ariaHidden: true
}),
// prepend current file id to the anchor permalink (see getId)
slugify: s => `${getId() ?? ""}-${encodeURIComponent(String(s).trim().toLowerCase().replace(/\s+/g, "-"))}`
slugify: s => `${getId() ?? ""}-${encodeURIComponent(String(s).trim().toLowerCase().replace(/\s+/g, "-").replace(/[^A-Za-z0-9_-]/g, ""))}`
});
let main = $("#main");