From d8eed94df23ea659c702551c353c06e00f8e3a1c Mon Sep 17 00:00:00 2001 From: Hyunje Jun Date: Wed, 18 Apr 2018 17:47:30 +0900 Subject: [PATCH] Use header's slug as it is if possible --- lib/util/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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) }) } })