diff --git a/src/Slugger.js b/src/Slugger.js index 51064211c1..00f63e48f1 100644 --- a/src/Slugger.js +++ b/src/Slugger.js @@ -13,6 +13,9 @@ module.exports = class Slugger { let slug = value .toLowerCase() .trim() + // remove html tags + .replace(/<[!\/a-z].*?>/ig, '') + // remove unwanted chars .replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g, '') .replace(/\s/g, '-'); diff --git a/src/TextRenderer.js b/src/TextRenderer.js index 652004d50c..48c36e6999 100644 --- a/src/TextRenderer.js +++ b/src/TextRenderer.js @@ -20,6 +20,10 @@ module.exports = class TextRenderer { return text; } + html(text) { + return text; + } + text(text) { return text; } diff --git a/test/specs/new/headings_id.html b/test/specs/new/headings_id.html index 6f0ae49e32..68d8ab4bcc 100644 --- a/test/specs/new/headings_id.html +++ b/test/specs/new/headings_id.html @@ -1,3 +1,5 @@ +
code