diff --git a/lib/util/index.js b/lib/util/index.js index 0545fe0fb2..bfa48e24cf 100644 --- a/lib/util/index.js +++ b/lib/util/index.js @@ -59,10 +59,11 @@ exports.extractHeaders = (content, include = [], md) => { tokens.forEach((t, i) => { if (t.type === 'heading_open' && include.includes(t.tag)) { const title = tokens[i + 1].content + const slug = t.attrs.find(([name]) => name === 'id')[1] res.push({ level: parseInt(t.tag.slice(1), 10), title, - slug: md.slugify(title) + slug: slug || md.slugify(title) }) } })