Strip HTML tag when rendering the headling

This commit is contained in:
qingwei.li 2016-11-27 14:01:05 +08:00
commit 8041c82e6d

View file

@ -19,7 +19,7 @@ const renderer = new marked.Renderer()
* @link https://github.com/chjj/marked#overriding-renderer-methods
*/
renderer.heading = function (text, level) {
const slug = text.toLowerCase().replace(/[\s\n\t]+/g, '-')
const slug = text.replace(/<(?:.|\n)*?>/gm, '').toLowerCase().replace(/[\s\n\t]+/g, '-')
toc.push({ level, slug, title: text })