/** * Turn a title or heading into a URL-safe slug. * Used for note slugs, tag URLs, heading ids and wikilink anchors, so they always agree. * @param {string} text * @returns {string} */ export function slugify(text) { return text .normalize('NFKD') .replace(/\p{M}/gu, '') .replace(/['"’“”]/g, '') .toLowerCase() .replace(/[^a-z0-9]+/g, '-') .replace(/^-+|-+$/g, ''); }