{"name":"rehype-sort-attributes","version":"3.0.2","description":"rehype plugin to reorder attributes based on how often they occur","license":"MIT","keywords":["unified","rehype","rehype-plugin","plugin","html","minify","mangle","attribute","sort"],"repository":{"type":"git","url":"https://github.com/rehypejs/rehype-minify/tree/main/packages/rehype-sort-attributes"},"bugs":{"url":"https://github.com/rehypejs/rehype-minify/issues"},"funding":{"type":"opencollective","url":"https://opencollective.com/unified"},"author":{"name":"Titus Wormer","email":"tituswormer@gmail.com","url":"https://wooorm.com"},"contributors":[{"name":"Titus Wormer","email":"tituswormer@gmail.com"}],"dependencies":{"unist-util-visit":"^2.0.0"},"xo":false,"_id":"rehype-sort-attributes@3.0.2","_nodeVersion":"14.0.0","_npmVersion":"6.14.5","dist":{"integrity":"sha512-roPtOHX6BfLXge161TnxOh+jr8JhZwUDVdqYI/qobYpfAkXgBfnftpWlwcShdsExa+nbUd5zU7z9A0nHBi35+A==","shasum":"18c7e86b34de4b0222d0d54412e860333bd74b7e","tarball":"http://registry-npm.ywwl.com/rehype-sort-attributes/download/rehype-sort-attributes-3.0.2.tgz","fileCount":3,"unpackedSize":5151,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJe/cGXCRA9TVsSAnZWagAAJbsP/0NL+hJMQKdrEVfIbpU3\nU7cCkclGfspQ3qho9+2cxPtt8MqxH6usce+pDsQM372GVtTcgQAnUpwdeMwr\nPxqtJ3762cXfA6V5Um1lXWPGJk5nAkHIuP/xh+tKrd2RsdKiZPNtGLZFTvLW\nRPcclFYY/Yx1LaduetA0ENNiDAwdKLKgH5RArDN2pJwPh0UAld5TZbnzrHL/\nkrBrAsKy8w9eanKTJG9x7EwCxAgLV6X7+Q6hlJxcIaA6M16buEeGJpuFvusq\nNffj51cetHKrJNUyl867NZSYh8RlHfbf25xjWv900deFq02bO49Gsr2jSqxN\nXuFrvQf9NG5qbvXeJVKsHxIvCCaW1sMyx6ChRghsB3bz9iGHN8dLe5QKLvvN\nBJtbOxa5XTSU0Wkv5MmvA17cJjYNK77SZnTz5OzK/r017fDjZhJacGJ3Vklo\nKMFS5jLpzseqhgOL8L+tgoaY6/fNtixqL2nAAjbb0kgMQ4u45Ev/kOQPjm8N\n/EWdd0BMgkdrlOWyIvfWBd2Y7bEW7lQr902FIq40Z/82pD6tBzD1+N2K9eMy\ngpw3iPVNfZ9xyG/PPLCEqdk2hOXLy3UQOBeW6YLRurumIXYuQCh/MMqJ9vKW\nIDq4Vr5nWN/+21DTmXvE36pzlk81udK5lYexw99vtLPAMAQSOSOA1IqRt+kl\nULzi\r\n=bYa2\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDreRT+Q56nhzm2C4pyjyfmTetLkFIWN32UOXyn1OunQAIgSCvnKiKn7liLlpShhdiUuExj589Olge17EAwqRJI3q0="}],"size":1981,"noattachment":false,"key":"/rehype-sort-attributes/-/rehype-sort-attributes-3.0.2.tgz"},"maintainers":[{"email":"keith@mcknig.ht","name":"kmck"},{"email":"tituswormer@gmail.com","name":"wooorm"}],"_npmUser":{"name":"wooorm","email":"tituswormer@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/rehype-sort-attributes_3.0.2_1593688471160_0.21552907073795868"},"_hasShrinkwrap":false,"readme":"<!--This file is generated-->\n\n# rehype-sort-attributes\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 sort attributes.\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(rehypeSortAttributeValues)`](#unifieduserehypesortattributevalues)\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 sorts attributes based on how frequent they\noccur, which optimizes for repetition-based compression (such as GZip).\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-sort-attributes\n```\n\nIn Deno with [`esm.sh`][esm-sh]:\n\n```js\nimport rehypeSortAttributes from 'https://esm.sh/rehype-sort-attributes@5'\n```\n\nIn browsers with [`esm.sh`][esm-sh]:\n\n```html\n<script type=\"module\">\n  import rehypeSortAttributes from 'https://esm.sh/rehype-sort-attributes@5?bundle'\n</script>\n```\n\n## Use\n\nOn the API:\n\n```js\nimport rehypeParse from 'rehype-parse'\nimport rehypeSortAttributes from 'rehype-sort-attributes'\nimport rehypeStringify from 'rehype-stringify'\nimport {read} from 'to-vfile'\nimport {unified} from 'unified'\n\nconst file = await unified()\n  .use(rehypeParse)\n  .use(rehypeSortAttributes)\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-sort-attributes --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-sort-attributes\",\n     …\n   ]\n }\n …\n```\n\n## API\n\nThis package exports no identifiers.\nThe default export is `rehypeSortAttributes`.\n\n### `unified().use(rehypeSortAttributeValues)`\n\nSort attributes.\n\n###### Returns\n\nTransform ([`Transformer`](https://github.com/unifiedjs/unified#transformer)).\n\n## Example\n\n###### In\n\n```html\n<div id=\"foo\">bar</div>\n<div class=\"baz\" id=\"qux\">quux</div>\n```\n\n###### Out\n\n```html\n<div id=\"foo\">bar</div>\n<div id=\"qux\" class=\"baz\">quux</div>\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-sort-attributes@^5`,\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-sort-attributes\n\n[downloads-badge]: https://img.shields.io/npm/dm/rehype-sort-attributes.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-sort-attributes\n\n[size-badge]: https://img.shields.io/bundlejs/size/rehype-sort-attributes\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":1593688471303,"_cnpm_publish_time":1593688471303,"dist-tags":{"latest":"5.0.1"}}