{"name":"rehype-remove-comments","version":"5.0.0","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@5.0.0","contributors":[{"name":"Titus Wormer","email":"tituswormer@gmail.com"}],"homepage":"https://github.com/rehypejs/rehype-minify/tree/main#readme","bugs":{"url":"https://github.com/rehypejs/rehype-minify/issues"},"xo":false,"dist":{"shasum":"88b4faba10f217d4ab68b36eb958b386630d5672","tarball":"http://registry-npm.ywwl.com/rehype-remove-comments/download/rehype-remove-comments-5.0.0.tgz","fileCount":4,"integrity":"sha512-sfiVT+u1in19sxo9vv/SDQVbHE2mADScNrpeVsUxBFl14zOMZnfPb6l4hR+lXqe10G13UFVqv5pt8zDbCR4JYQ==","signatures":[{"sig":"MEYCIQCS4DTiyG4koUzkr0JJ8DW4Twqzafd5aQfAYPCtJXMuIgIhANLr0RsjE9exZXSwKB2LzgBXTM4Ys9Io8AdLF2RDDWlJ","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":6743,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhBvDYCRA9TVsSAnZWagAAs14P/i1uBSese5aqOq6CIRJd\nRElx5QmysoIVN8FLxl8lqKY4jKA8kW40BMK7ANucdQ2KGHpAj7Qug+VcM9/Z\nkNUEaZM9GAs+Td8Z8IRU3tgNobKpHwYUu+/8hz9Kf60n9lAIkpWvV86x1x5L\n6PYoOSMiaXospWuR97qrWT4hbLgC8sJtIsOy8JzLOIWGqHlTzRfy9ytiFX25\naFP2UmeEPTEc/1AMK7sg4Zx5rs6bmvf7BD9Sg6EciVj7NDc9X0T469MRYha0\nXs1ROzPMqwMLZDP+hIR6YDnPU5eTFwliTkg+aSbi0Uxin6DG8d73Q67U+278\nh+SqXhRuGWCzdgGF52dvOiXmNK0dQvMi6QQwzHiY1YgP83o/nuz38JSyrO8U\nUbvGYCSy5APoecuGBpa8Kncu8BQkrUutRUYRkSy8/r69u/mb2RjwGVzGIRZw\neqFIoANgKllQsItloyLjrIG62i8QB4WhSf6jbXJeK15dNAU57vI4+9n2FM86\nIgCnbruec6k4P2n2+R32bqY0PWeaaOpA3kGwyk7/B6WbI4jsd3DJHAMbjkKx\ninVP5G+n1EYq6nIqfUd4LYj7TsEQdSRf7JTU1E8EyNRQwAJRMOkFW/oMo0Og\nx/1wuLokth6t0v2J4AXRgadcpcE8coOInLnAm68i29L3NxMRHqLPnJTbdx5O\nce/T\r\n=oU3X\r\n-----END PGP SIGNATURE-----\r\n","size":2457,"noattachment":false,"key":"/rehype-remove-comments/-/rehype-remove-comments-5.0.0.tgz"},"main":"index.js","type":"module","types":"index.d.ts","funding":{"url":"https://opencollective.com/unified","type":"opencollective"},"scripts":{"test":"node --conditions development test.js","build":"rimraf \"*.d.ts\" && tsc && type-coverage"},"_npmUser":{"name":"wooorm","email":"tituswormer@gmail.com"},"repository":{"url":"git+https://github.com/rehypejs/rehype-minify.git#main","type":"git"},"_npmVersion":"7.18.1","description":"rehype plugin to remove comments (except conditional comments)","directories":{},"sideEffects":false,"_nodeVersion":"16.2.0","dependencies":{"unified":"^10.0.0","@types/hast":"^2.0.0","unist-util-filter":"^4.0.0","hast-util-is-conditional-comment":"^2.0.0"},"typeCoverage":{"detail":true,"strict":true,"atLeast":100,"ignoreCatch":true},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/rehype-remove-comments_5.0.0_1627844824132_0.76241003876323","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":1627844824235,"maintainers":[{"name":"remcohaszing","email":"remcohaszing@gmail.com"},{"name":"wooorm","email":"tituswormer@gmail.com"},{"name":"kmck","email":"keith@mcknig.ht"}],"_cnpm_publish_time":1627844824235,"dist-tags":{"latest":"6.1.1"}}