{"name":"rehype-sort-attributes","version":"2.0.0","description":"Reorder attributes based on how often they occur","license":"MIT","keywords":["rehype","hast","attribute","sort"],"repository":{"type":"git","url":"https://github.com/rehypejs/rehype-minify/tree/master/packages/rehype-sort-attributes"},"bugs":{"url":"https://github.com/rehypejs/rehype-minify/issues"},"author":{"name":"Titus Wormer","email":"tituswormer@gmail.com","url":"https://wooorm.com"},"contributors":[{"name":"Titus Wormer","email":"tituswormer@gmail.com"}],"dependencies":{"unist-util-visit":"^1.0.0"},"xo":false,"_id":"rehype-sort-attributes@2.0.0","_npmVersion":"6.4.1","_nodeVersion":"11.0.0","_npmUser":{"name":"wooorm","email":"tituswormer@gmail.com"},"dist":{"integrity":"sha512-GiezrmdHtSnVKaeHkffQjy9RRVhzDHxxz47UURDiP8qXDCnqPHky90xQgnz6o+SgO2vuvItt2YPdXjbvR3uR4A==","shasum":"dc4060cca02df734ed1e19cdb94fd4496bbc4a74","tarball":"http://registry-npm.ywwl.com/rehype-sort-attributes/download/rehype-sort-attributes-2.0.0.tgz","fileCount":3,"unpackedSize":3168,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb8FtsCRA9TVsSAnZWagAA3NEP/1hOaVxzALCz8LqGy/tL\nfJOA0HqEhwPt99Wjd02LLQ96mxa8l9oJXFI/SqI75REcH1toHMQyNwdrmklC\nRAm5xInh2LoKOMvuuLq5VivMtPWNAqJjustIIStTpJfKS5JsxHgNgLsQjJia\nTxRG3LU2fajp5XPISc8BTpnAjKZSKPU7WAAcXeuf3J/6D3W4rdSkllEIGew7\nU8f3BFluSF1h7/BelEOqhnpo6XEIqkyyXs/gsuugoQHnXRn/j1TmM7MmkUdc\nIP1UtUygPnzcQ2DVZkllvW14Ca3mF+7bLNZ1n2Uf0yNGjrALr6itWimeien1\n1gGsE6oyJg5UHXi3iC66SS+afDir6jylJT1hvbm14c1YcDXF0XGDYmiRfR3l\n62w00XN+Gi/w+VIRWPLHjABKzKmv0QZFiJXqUyv7TbP5hUoVs2R85WThGxKp\nm1XPj0HfDmlmgNqZkaEYUxpzkCwjDMXutqgIX73fu0U+WR+TLAspTL+uvSL/\na3H5ldJvbOM5TaSe0Qlc6sJehbUAOJlkhsXD3Pi7PSTfz6d7SJGk1JP/GzoQ\nelRmOarTfRHHFulMSyMc8X3kTs7hjkFh4L0AiKlpc768cNM4bVk3usW6tlMz\n8S1N5Dki2zlwa5Xbxpp4UFyyVqqNwhe5V7PxKolsyb0Q2ODeIvRrDxuqyxjF\n87Cc\r\n=jwcq\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICjtWo5l5g8gWLKOueElJXXJahFpwbyTw3IJlxT5SFd0AiEA/jm5oJRWMdxtFycWfQ8fXP51u0xdEplZYL+C2ebgUtQ="}],"size":1362,"noattachment":false,"key":"/rehype-sort-attributes/-/rehype-sort-attributes-2.0.0.tgz"},"maintainers":[{"name":"wooorm","email":"tituswormer@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/rehype-sort-attributes_2.0.0_1542478699738_0.7245524904098473"},"_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":1542478699906,"_cnpm_publish_time":1542478699906,"dist-tags":{"latest":"5.0.1"}}