rehype-remove-comments

rehype plugin to remove comments (except conditional comments)

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
rehype-remove-comments
5.0.0a year ago6 years agoMinified + gzip package size for rehype-remove-comments in KB

Readme

rehype-remove-comments
!Buildbuild-badgebuild !Coveragecoverage-badgecoverage !Downloadsdownloads-badgedownloads !Sizesize-badgesize !Sponsorssponsors-badgecollective !Backersbackers-badgecollective !Chatchat-badgechat
Remove comments (except conditional comments).
When configured with force: true (default: false), conditional comments are also removed.

Install

This package is ESM onlyesm: Node 12+ is needed to use it and it must be importeded instead of requiredd.
npm install rehype-remove-comments
This package exports no identifiers.
The default export is `rehypeRemoveComments`

## Use

On the API:

```diff
 import {unified} from 'unified'
 import rehypeParse from 'rehype-parse'
+import rehypeRemoveComments from 'rehype-remove-comments'
 import rehypeStringify from 'rehype-stringify'

 unified()
   .use(rehypeParse)
+  .use(rehypeRemoveComments)
   .use(rehypeStringify)
   .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 output.html

Example

In
<!--Hello-->
<!--[if IE 6]>OK<![endif]-->
Out
<!--[if IE 6]>OK<![endif]-->

Contribute

See contributing.mdcontributing in rehypejs/.githubhealth for ways to get started. See support.mdsupport for ways to get help.
This project has a code of conductcoc. By interacting with this repository, organization, or community you agree to abide by its terms.

License

MITlicense © Titus Wormerauthor