{"name":"rehype-remove-comments","version":"4.0.1","keywords":["unified","rehype","rehype-plugin","plugin","html","minify","mangle","comment"],"author":{"url":"https://wooorm.com","name":"Titus Wormer","email":"tituswormer@gmail.com"},"license":"MIT","_id":"rehype-remove-comments@4.0.1","contributors":[{"name":"Titus Wormer","email":"tituswormer@gmail.com"}],"bugs":{"url":"https://github.com/rehypejs/rehype-minify/issues"},"xo":false,"dist":{"shasum":"a96da674bad0edafca41f645705efa37cab0e84b","tarball":"http://registry-npm.ywwl.com/rehype-remove-comments/download/rehype-remove-comments-4.0.1.tgz","fileCount":3,"integrity":"sha512-4JWzV4cbqeNM3qJEczYRyt+ZPy59iBcaKKtTy6eXigGT/vpqRKrFocAmWxyDhSQyJSgysqtDb7jdJW49oTDWQQ==","signatures":[{"sig":"MEUCIA8z2Y31CnkxVIAy1U7563YDCjzU3F3QNPkTLto8BYk0AiEA3Xtg/r7z6wEBreZNxH6Ki5ew+HXKyxuSloZLMZ8l1vo=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":3911,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJedl0ICRA9TVsSAnZWagAArYEQAJdl+42MnEl2l2vNmtaf\nmnig0USn43LlmV/9gdztGKHOwl8w1RyhrvhbHKokDKkX+P1tLXqbA8cndwdc\nEMvHkZVjMjlhXhde3LY8zNjK4hm1t1faEMNXu9XSVwGreMQODSf71KQyEUfZ\ncy8xnBuCnuMDmXaR8kqU9z2QpOE1/KX/NtcE5XaQyxoPyFLcjIW6UVnFgddP\n0IMNucZwu+tGUepeY74jQ1CgMd/krSC3ZoWZ++hetZhYfvNUIAaq4NPYOyBN\nnNs1I+4L+gG93R2IKm2QqA/1zO7LQq7G45F6uv0h/H57Lb9QDD6dpb+TObpZ\nDgkbFw6Ln0Ltu5d1Xvb9w5K7TK0eqRka/hbXt0oSQj0HCI6Q59oGlHrTEQCw\nKb6Uu1p0Pc+DLPPsYxyJgj3PNkyg4108/JOo9YfaS/nIujqudAhps4CfDJnq\nPmoZj3vdHRhuUBkGri2lYUep8j9rxnEpgXeVkxnkX5Ki9VO2YLr+VcVh8Lfk\nH38gc4fxQQQ4wm64/AjKE01pctzjPbhXgR7nhbfXLVliZwNNas6726VtyeA9\nOBsDiHDA3CBXWLZnS+C1X3i+bdAiQlF+v5ugElu2pptpvgD/ymHlkxk3loAJ\nK5KyyBZjP3skBe0xZ9bZtYZgiRCW76C0tevT7esydg4hpE2yQhi7HvoAlGp0\ng4e2\r\n=GQaK\r\n-----END PGP SIGNATURE-----\r\n","size":1547,"noattachment":false,"key":"/rehype-remove-comments/-/rehype-remove-comments-4.0.1.tgz"},"funding":{"url":"https://opencollective.com/unified","type":"opencollective"},"_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.14.3","description":"rehype plugin to remove comments (except conditional comments)","directories":{},"_nodeVersion":"13.10.1","dependencies":{"unist-util-filter":"^2.0.0","hast-util-is-conditional-comment":"^1.0.0"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/rehype-remove-comments_4.0.1_1584815368008_0.7773368092293167","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":1584815368122,"maintainers":[{"name":"remcohaszing","email":"remcohaszing@gmail.com"},{"name":"wooorm","email":"tituswormer@gmail.com"},{"name":"kmck","email":"keith@mcknig.ht"}],"_cnpm_publish_time":1584815368122,"dist-tags":{"latest":"6.1.1"}}