rehype-remove-comments
Remove comments (except conditional comments).
When configured with force: true
(default: false
), conditional comments are also removed.
Install
npm:
npm install rehype-remove-comments
Use
On the API:
unified()
.use(require('rehype-parse'))
+ .use(require('rehype-remove-comments'))
.use(require('rehype-stringify'))
.process('<span>some html</span>', function (err, file) {
console.error(report(err || file))
console.log(String(file))
})
On the CLI:
rehype input.html --use remove-comments > output.html
Example
In
<!--Hello-->
<!--[if IE 6]>OK<![endif]-->
Out
<!--[if IE 6]>OK<![endif]-->
Contribute
See contributing.md
in rehypejs/.github
for ways to get started. See support.md
for ways to get help.
This project has a code of conduct. By interacting with this repository, organization, or community you agree to abide by its terms.