diff --git a/lib/CodeSection.js b/lib/CodeSection.js index 52ad8b3d6..c584946e2 100644 --- a/lib/CodeSection.js +++ b/lib/CodeSection.js @@ -20,7 +20,7 @@ const hljs = require('highlight.js'); const marked = require('marked'); const renderer = new marked.Renderer(); renderer.heading = function (text, level) { - const escapedText = text.toLowerCase().replace(/[^\w]+/g, '-'); + const escapedText = text.toLowerCase().replace(/\s+/g, '-'); return '' + text + ''; @@ -245,7 +245,7 @@ module.exports = class CodeSection { } const name = matches[1].trim().replace(/`/g, ''); const heading = { - id: name.toLowerCase().replace(/[^\w]+/g, '-'), + id: name.toLowerCase().replace(/\s+/g, '-'), name: name }; this.headings.push(heading);