mirror of
https://github.com/benjaminion/upgrading-ethereum-book.git
synced 2026-01-08 06:03:53 -05:00
20 lines
401 B
JavaScript
20 lines
401 B
JavaScript
const visit = require('unist-util-visit')
|
|
|
|
// Remove HTML comments from the Markdown AST
|
|
|
|
module.exports = ({ markdownAST }) => {
|
|
|
|
try {
|
|
visit(markdownAST, 'html', (node, index, parent) => {
|
|
if (node.value.startsWith('<!-- ')) {
|
|
parent.children.splice(index, 1)
|
|
return [visit.SKIP, index]
|
|
}
|
|
})
|
|
} catch (err) {
|
|
console.error(err)
|
|
}
|
|
|
|
return markdownAST
|
|
}
|