docs_vue2/one/build/rehype-scoped.js

14 lines
319 B
JavaScript
Raw Permalink 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)) {
2022-05-26 19:16:47 +08:00
properties['data-md'] = true
2021-09-25 15:17:57 +08:00
}
})
}
}