UNPKG

316 BJavaScriptView Raw
1const visit = require('unist-util-visit')
2const {isComment, getCommentContents} = require('@mdx-js/util')
3
4module.exports = _options => tree => {
5 visit(tree, 'jsx', node => {
6 if (isComment(node.value)) {
7 node.type = 'comment'
8 node.value = getCommentContents(node.value)
9 }
10 })
11
12 return tree
13}