blob: a638339883d8786558d9358990d963cf89b63efe (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
module.exports = md => {
const RE = /^<(script|style)(?=(\s|>|$))/i
md.renderer.rules.html_block = (tokens, idx) => {
const content = tokens[idx].content
const hoistedTags = md.__data.hoistedTags || (md.__data.hoistedTags = [])
if (RE.test(content.trim())) {
hoistedTags.push(content)
return ''
} else {
return content
}
}
}
|