diff --git a/docs/.eleventy.js b/docs/.eleventy.js index eee65d75962..1bd1de1af2f 100644 --- a/docs/.eleventy.js +++ b/docs/.eleventy.js @@ -64,23 +64,12 @@ module.exports = function(eleventyConfig) { eleventyConfig.addFilter("jsonify", variable => JSON.stringify(variable)); - /** - * Takes in a string and converts to a slug - * @param {string} text text to be converted into slug - * @returns {string} slug to be used as anchors - */ - function slugify(text) { - return slug(text.replace(/[<>()[\]{}]/gu, "")) - // eslint-disable-next-line no-control-regex -- used regex from https://github.com/eslint/archive-website/blob/master/_11ty/plugins/markdown-plugins.js#L37 - .replace(/[^\u{00}-\u{FF}]/gu, ""); - } - eleventyConfig.addFilter("slugify", str => { if (!str) { return ""; } - return slugify(str); + return slug(str); }); eleventyConfig.addFilter("URIencode", str => { @@ -193,7 +182,7 @@ module.exports = function(eleventyConfig) { const markdownIt = require("markdown-it"); const md = markdownIt({ html: true, linkify: true, typographer: true, highlight: (str, lang) => highlighter(md, str, lang) }) .use(markdownItAnchor, { - slugify + slugify: s => slug(s) }) .use(markdownItContainer, "img-container", {}) .use(markdownItContainer, "correct", {}) diff --git a/docs/package.json b/docs/package.json index b60c08f5dd8..e0defad6d23 100644 --- a/docs/package.json +++ b/docs/package.json @@ -31,7 +31,7 @@ "eleventy-plugin-nesting-toc": "^1.3.0", "eleventy-plugin-page-assets": "^0.3.0", "eleventy-plugin-reading-time": "^0.0.1", - "github-slugger": "^1.4.0", + "github-slugger": "^1.5.0", "imagemin": "^8.0.1", "imagemin-cli": "^7.0.0", "js-yaml": "^3.14.1",