{"name":"rehype-remove-comments","version":"2.0.2","keywords":["unified","rehype","hast","javascript","src"],"author":{"url":"https://wooorm.com","name":"Titus Wormer","email":"tituswormer@gmail.com"},"license":"MIT","_id":"rehype-remove-comments@2.0.2","contributors":[{"name":"Titus Wormer","email":"tituswormer@gmail.com"}],"bugs":{"url":"https://github.com/rehypejs/rehype-minify/issues"},"xo":false,"dist":{"shasum":"9a3b0bf5ba6854f16adbdb6f05e3f9757fb928d5","tarball":"http://registry-npm.ywwl.com/rehype-remove-comments/download/rehype-remove-comments-2.0.2.tgz","fileCount":3,"integrity":"sha512-puAVsG8xizzCWUULnXFc/aDmJRmVwJOgdszSEbo4vw2wdzVq0ELVu2H9qQwc0nhpWLpOVoDrvrWz+cqgIfFq3A==","signatures":[{"sig":"MEUCIFhTU1C/QVwGbWIMx9dmLO7NumHmXcMLq67+hQqZs6GJAiEA8ES2MnYfAuSIO9XY7cUeuH3WNELdQl1bNNdJZJHavS4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":3787,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJc8oC6CRA9TVsSAnZWagAA2hYP/RZLwawgTpHeOIPPismf\nZ4Uutme3BUppj6DGuIrmgqXkcLMlEfS1YjBn35PddWtiwIwWuoFHyBAQsr4f\n6Mxrnsz4FR2F1gHMJC0g1H7ag9OEFRCjhSCwij51aoRW5cWZg/uJQ7wAAYJP\n/BNaZ2voVUawiNZer1RD0PxdbV5w5takWKBzzh5AgoKhL/4G2hrYacISHEly\ns42I3WER/3iSNW5LNuTf7XILncQGaC5mW/DogKSwZaSmAe/s4O+3lTPrfQCg\ncVHAXnQJuvDXFKtPt2iSQhWlsFjjB0aSeXbTut1G/Sn2iP3o6+QEZCyyhLTX\nU/Tdy9IVgPcRrvXhbRDC1+x9jNMfcGnbPGklG/KboganmSjJ/eAQs5/pwyuK\n3BpbUHo3LDwGgwVqnjfxoy2MgrmyO6rOmKftjWoINzREiF/NDbxUsgIT8RGH\n0SJXrTNufFFE0jn2zVx1xTjU+KH5k/r2PZjPZKKQcJcT5O0OayMnOiLOiC0y\nVFW+WyyzsYHz166UYFIHBySN5ClTBgb5bbSRvdvM7CtaUtQdRT63zh/Xx3St\nYuahoaBfqSr67+QIldanOf8CIBA/qeMI/AZm/F7pGQ04Lx3XF7v5YmVXD2zk\n4tGq+vOBTFAq1FG6j5TNRJYqA3ryH1ScHhsRbJvNvXZgNKnR0GLGWetjQbkm\nDf0Z\r\n=jB5h\r\n-----END PGP SIGNATURE-----\r\n","size":1520,"noattachment":false,"key":"/rehype-remove-comments/-/rehype-remove-comments-2.0.2.tgz"},"_npmUser":{"name":"wooorm","email":"tituswormer@gmail.com"},"repository":{"url":"https://github.com/rehypejs/rehype-minify/tree/master/packages/rehype-remove-comments","type":"git"},"_npmVersion":"6.9.0","description":"rehype plugin to remove comments (except conditional comments)","directories":{},"_nodeVersion":"12.2.0","dependencies":{"unist-util-filter":"^1.0.0","hast-util-is-conditional-comment":"^1.0.0"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/rehype-remove-comments_2.0.2_1559396537693_0.3208249820091238","host":"s3://npm-registry-packages"},"readme":"<!--This file is generated-->\n\n# rehype-remove-comments\n\n[![Build][build-badge]][build]\n[![Coverage][coverage-badge]][coverage]\n[![Downloads][downloads-badge]][downloads]\n[![Size][size-badge]][size]\n[![Sponsors][funding-sponsors-badge]][funding]\n[![Backers][funding-backers-badge]][funding]\n[![Chat][chat-badge]][chat]\n\n**[rehype][]** plugin to remove comments.\n\n## Contents\n\n* [What is this?](#what-is-this)\n* [When should I use this?](#when-should-i-use-this)\n* [Install](#install)\n* [Use](#use)\n* [API](#api)\n  * [`unified().use(rehypeRemoveComments[, options])`](#unifieduserehyperemovecomments-options)\n  * [`Options`](#options)\n  * [`Test`](#test)\n* [Example](#example)\n* [Syntax](#syntax)\n* [Syntax tree](#syntax-tree)\n* [Types](#types)\n* [Compatibility](#compatibility)\n* [Security](#security)\n* [Contribute](#contribute)\n* [License](#license)\n\n## What is this?\n\nThis package is a plugin that removes comments.\nBy default it keeps conditional comments, optionally it removes them too.\n\n## When should I use this?\n\nYou can use this plugin when you want to improve the transfer size of HTML\ndocuments.\n\n## Install\n\nThis package is [ESM only][esm].\nIn Node.js (version 16+), install with [npm][]:\n\n```sh\nnpm install rehype-remove-comments\n```\n\nIn Deno with [`esm.sh`][esm-sh]:\n\n```js\nimport rehypeRemoveComments from 'https://esm.sh/rehype-remove-comments@6'\n```\n\nIn browsers with [`esm.sh`][esm-sh]:\n\n```html\n<script type=\"module\">\n  import rehypeRemoveComments from 'https://esm.sh/rehype-remove-comments@6?bundle'\n</script>\n```\n\n## Use\n\nOn the API:\n\n```js\nimport rehypeParse from 'rehype-parse'\nimport rehypeRemoveComments from 'rehype-remove-comments'\nimport rehypeStringify from 'rehype-stringify'\nimport {read} from 'to-vfile'\nimport {unified} from 'unified'\n\nconst file = await unified()\n  .use(rehypeParse)\n  .use(rehypeRemoveComments)\n  .use(rehypeStringify)\n  .process(await read('index.html'))\n\nconsole.log(String(file))\n```\n\nOn the CLI:\n\n```sh\nrehype input.html --use rehype-remove-comments --output output.html\n```\n\nOn the CLI in a config file (here a `package.json`):\n\n```diff\n …\n \"rehype\": {\n   \"plugins\": [\n     …\n+    \"rehype-remove-comments\",\n     …\n   ]\n }\n …\n```\n\n## API\n\nThis package exports no identifiers.\nThe default export is `rehypeRemoveComments`.\n\n### `unified().use(rehypeRemoveComments[, options])`\n\nRemove comments.\n\n###### Parameters\n\n* `options` (`Options`, optional)\n  — configuration\n\n###### Returns\n\nTransform ([`Transformer`](https://github.com/unifiedjs/unified#transformer)).\n\n### `Options`\n\nConfiguration (TypeScript type).\n\n###### Fields\n\n* `removeConditional` (`boolean`, default: `false`)\n  — remove conditional comments (default: `false`); the default is to\n  leave them\n* `test` (`Test`, optional)\n  — choose which comments to keep (optional)\n\n### `Test`\n\nTest a comment (TypeScript type).\n\n###### Parameters\n\n* `value` (`string`)\n  — comment value\n\n###### Returns\n\nWhether to keep the comment (`boolean`, optional).\n\n## Example\n\n###### In\n\n```html\n<!--Hello-->\n<!--[if IE 6]>OK<![endif]-->\n```\n\n###### Out\n\n```html\n<!--[if IE 6]>OK<![endif]-->\n```\n\n## Syntax\n\nHTML is parsed according to WHATWG HTML (the living standard), which is also\nfollowed by all browsers.\n\n## Syntax tree\n\nThe syntax tree used is [hast][].\n\n## Types\n\nThis package is fully typed with [TypeScript][].\n\n## Compatibility\n\nProjects maintained by the unified collective are compatible with maintained\nversions of Node.js.\n\nWhen we cut a new major release, we drop support for unmaintained versions of\nNode.\nThis means we try to keep the current release line,\n`rehype-remove-comments@^6`,\ncompatible with Node.js 16.\n\n## Security\n\nAs **rehype** works on HTML and improper use of HTML can open you up to a\n[cross-site scripting (XSS)][xss] attack, use of rehype can also be unsafe.\nUse [`rehype-sanitize`][rehype-sanitize] to make the tree safe.\n\n## Contribute\n\nSee [`contributing.md`][contributing] in [`rehypejs/.github`][health] for ways\nto get started.\nSee [`support.md`][support] for ways to get help.\n\nThis project has a [code of conduct][coc].\nBy interacting with this repository, organization, or community you agree to\nabide by its terms.\n\n## License\n\n[MIT][license] © [Titus Wormer][author]\n\n[author]: https://wooorm.com\n\n[build]: https://github.com/rehypejs/rehype-minify/actions\n\n[build-badge]: https://github.com/rehypejs/rehype-minify/workflows/main/badge.svg\n\n[chat]: https://github.com/rehypejs/rehype/discussions\n\n[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg\n\n[coc]: https://github.com/rehypejs/.github/blob/main/code-of-conduct.md\n\n[contributing]: https://github.com/rehypejs/.github/blob/main/contributing.md\n\n[coverage]: https://codecov.io/github/rehypejs/rehype-minify\n\n[coverage-badge]: https://img.shields.io/codecov/c/github/rehypejs/rehype-minify.svg\n\n[downloads]: https://www.npmjs.com/package/rehype-remove-comments\n\n[downloads-badge]: https://img.shields.io/npm/dm/rehype-remove-comments.svg\n\n[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c\n\n[esm-sh]: https://esm.sh\n\n[funding]: https://opencollective.com/unified\n\n[funding-backers-badge]: https://opencollective.com/unified/backers/badge.svg\n\n[funding-sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg\n\n[hast]: https://github.com/syntax-tree/hast\n\n[health]: https://github.com/rehypejs/.github\n\n[license]: https://github.com/rehypejs/rehype-minify/blob/main/license\n\n[npm]: https://docs.npmjs.com/cli/install\n\n[rehype]: https://github.com/rehypejs/rehype\n\n[rehype-sanitize]: https://github.com/rehypejs/rehype-sanitize\n\n[size]: https://bundlejs.com/?q=rehype-remove-comments\n\n[size-badge]: https://img.shields.io/bundlejs/size/rehype-remove-comments\n\n[support]: https://github.com/rehypejs/.github/blob/main/support.md\n\n[typescript]: https://www.typescriptlang.org\n\n[xss]: https://en.wikipedia.org/wiki/Cross-site_scripting\n","publish_time":1559396537809,"maintainers":[{"name":"remcohaszing","email":"remcohaszing@gmail.com"},{"name":"wooorm","email":"tituswormer@gmail.com"},{"name":"kmck","email":"keith@mcknig.ht"}],"_cnpm_publish_time":1559396537809,"dist-tags":{"latest":"6.1.1"}}