{"name":"rehype-minify-whitespace","version":"6.0.1","keywords":["collapse","html","mangle","minify","plugin","rehype","rehype-plugin","space","unified","white","whitespace"],"author":{"url":"https://wooorm.com","name":"Titus Wormer","email":"tituswormer@gmail.com"},"license":"MIT","_id":"rehype-minify-whitespace@6.0.1","maintainers":[{"name":"remcohaszing","email":"remcohaszing@gmail.com"},{"name":"wooorm","email":"tituswormer@gmail.com"},{"name":"kmck","email":"keith@mcknig.ht"}],"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":{"rules":{"capitalized-comments":"off","unicorn/prefer-string-replace-all":"off"},"prettier":true},"dist":{"shasum":"923f79e5047f12e81646e4923b6ac8284f650e1a","tarball":"http://registry-npm.ywwl.com/rehype-minify-whitespace/download/rehype-minify-whitespace-6.0.1.tgz","fileCount":8,"integrity":"sha512-3oJZ3O8ukn6cNJ8elg8dU/tMCH4CDk7elE9x5G+dKL1qQYXeVnsDkSz17sAiUKIoDOXUUkOyC/VMNGEHbPmCew==","signatures":[{"sig":"MEQCIHubCKZ2tG7LjNm6V8zmA9SvAQ3gInz217CoxSTYT9E0AiBb2G+cihoFh/NNLy+KPuDtbyVKkY2VMY0PwOntrtaFmw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":9402,"size":3444,"noattachment":false,"key":"/rehype-minify-whitespace/-/rehype-minify-whitespace-6.0.1.tgz"},"type":"module","types":"./index.d.ts","exports":"./index.js","funding":{"url":"https://opencollective.com/unified","type":"opencollective"},"gitHead":"a545e79f67b9215899c30287639fffc1aad06c89","scripts":{},"_npmUser":{"name":"wooorm","email":"tituswormer@gmail.com"},"repository":{"url":"git+https://github.com/rehypejs/rehype-minify.git#main","type":"git"},"_npmVersion":"10.8.3","description":"rehype plugin to collapse whitespace","directories":{},"sideEffects":false,"_nodeVersion":"22.7.0","dependencies":{"@types/hast":"^3.0.0","hast-util-minify-whitespace":"^1.0.0"},"typeCoverage":{"detail":true,"strict":true,"atLeast":100,"ignoreCatch":true},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/rehype-minify-whitespace_6.0.1_1726584640384_0.2446374344685731","host":"s3://npm-registry-packages"},"readme":"<!--This file is generated-->\n\n# rehype-minify-whitespace\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 minify whitespace between elements.\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(rehypeMinifyWhitespace[, options])`](#unifieduserehypeminifywhitespace-options)\n  * [`Options`](#options)\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 can minify the whitespace between elements.\n\n## When should I use this?\n\nYou can use this plugin when you want to improve the size of HTML documents.\n\n## Install\n\nThis package is [ESM only][esm].\nIn Node.js (version 16+), install with [npm][]:\n\n```sh\nnpm install rehype-minify-whitespace\n```\n\nIn Deno with [`esm.sh`][esm-sh]:\n\n```js\nimport rehypeMinifyWhitespace from 'https://esm.sh/rehype-minify-whitespace@6'\n```\n\nIn browsers with [`esm.sh`][esm-sh]:\n\n```html\n<script type=\"module\">\n  import rehypeMinifyWhitespace from 'https://esm.sh/rehype-minify-whitespace@6?bundle'\n</script>\n```\n\n## Use\n\nOn the API:\n\n```js\nimport rehypeMinifyWhitespace from 'rehype-minify-whitespace'\nimport rehypeParse from 'rehype-parse'\nimport rehypeStringify from 'rehype-stringify'\nimport {read} from 'to-vfile'\nimport {unified} from 'unified'\n\nconst file = await unified()\n  .use(rehypeParse)\n  .use(rehypeMinifyWhitespace)\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-minify-whitespace --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-minify-whitespace\",\n     …\n   ]\n }\n …\n```\n\n## API\n\nThis package exports no identifiers.\nThe default export is `rehypeMinifyWhitespace`.\n\n### `unified().use(rehypeMinifyWhitespace[, options])`\n\nMinify whitespace.\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).\n\n###### Fields\n\n* `newlines` (`boolean`, default: `false`)\n  — collapse whitespace containing newlines to `'\\n'` instead of `' '`;\n  the default is to collapse to a single space\n\n## Example\n\n###### In\n\n```html\n<h1>Heading</h1>\n<p><strong>This</strong> and <em>that</em></p>\n```\n\n###### Out\n\n```html\n<h1>Heading</h1><p><strong>This</strong> and <em>that</em></p>\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-minify-whitespace@^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-minify-whitespace\n\n[downloads-badge]: https://img.shields.io/npm/dm/rehype-minify-whitespace.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-minify-whitespace\n\n[size-badge]: https://img.shields.io/bundlejs/size/rehype-minify-whitespace\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":1726584640606,"_cnpm_publish_time":1726584640606,"dist-tags":{"latest":"6.0.2"}}