Strip HTML tag when rendering the headling
This commit is contained in:
parent
5e38b702cd
commit
8041c82e6d
1 changed files with 1 additions and 1 deletions
|
|
@ -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 })
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue