docs_vue2/one/build/rehype-scoped.js

14 lines
325 B
JavaScript
Raw Normal View History

2021-09-25 15:17:57 +08:00
import visit from 'unist-util-visit'
const RE_DEMO = /^one-demo-[a-f0-9]+/i
export default function attacher () {
return tree => {
visit(tree, 'element', ({ tagName, properties }, _, { type }) => {
if (type === 'root' && !RE_DEMO.test(tagName)) {
properties['data-markdown'] = true
}
})
}
}