{"name":"rehype","version":"13.0.0","description":"HTML processor powered by plugins part of the unified collective","license":"MIT","keywords":["abstract","ast","html","parse","process","rehype","serialize","stringify","syntax","tree","unified"],"dependencies":{"@types/hast":"^3.0.0","rehype-parse":"^9.0.0","rehype-stringify":"^10.0.0","unified":"^11.0.0"},"homepage":"https://github.com/rehypejs/rehype","repository":{"type":"git","url":"git+https://github.com/rehypejs/rehype.git#main"},"bugs":{"url":"https://github.com/rehypejs/rehype/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","url":"https://wooorm.com"}],"sideEffects":false,"type":"module","exports":"./index.js","scripts":{},"xo":false,"typeCoverage":{"atLeast":100,"detail":true,"strict":true,"ignoreCatch":true},"gitHead":"6d822c18a7df98c327ac025c686c42ed4d86467e","types":"./index.d.ts","_id":"rehype@13.0.0","_nodeVersion":"20.0.0","_npmVersion":"9.7.2","dist":{"integrity":"sha512-oKDh5mN59cKd8Fu/V8pomLcodHIlCGNnbIieQUSUTzUxEQYZ6vUcwcGTk8lcxvByeVgMcHAzLOI16rkM99dcXA==","shasum":"ab3f1c8e11b231869c4ef839db731dde5fb327e5","tarball":"http://registry-npm.ywwl.com/rehype/download/rehype-13.0.0.tgz","fileCount":4,"unpackedSize":12120,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDSNqs3DHqDbZVbQMR4/13xzp1eUp+pln72xzg9z650EQIgCKypWA0PG/US+zJLnyMSo76FaivrLcQjlKnsX+oFYWs="}],"size":4041,"noattachment":false,"key":"/rehype/-/rehype-13.0.0.tgz"},"_npmUser":{"name":"wooorm","email":"tituswormer@gmail.com"},"directories":{},"maintainers":[{"name":"wooorm","email":"tituswormer@gmail.com"},{"name":"kmck","email":"keith@mcknig.ht"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/rehype_13.0.0_1693041467875_0.8987887543963788"},"_hasShrinkwrap":false,"readme":"# rehype\n\n[![Build][build-badge]][build]\n[![Coverage][coverage-badge]][coverage]\n[![Downloads][downloads-badge]][downloads]\n[![Size][size-badge]][size]\n[![Sponsors][sponsors-badge]][collective]\n[![Backers][backers-badge]][collective]\n[![Chat][chat-badge]][chat]\n\n**[unified][]** processor to add support for parsing from HTML and serializing\nto HTML.\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    *   [`rehype()`](#rehype-1)\n*   [Examples](#examples)\n    *   [Example: passing options to `rehype-parse`, `rehype-stringify`](#example-passing-options-to-rehype-parse-rehype-stringify)\n*   [Syntax](#syntax)\n*   [Syntax tree](#syntax-tree)\n*   [Types](#types)\n*   [Compatibility](#compatibility)\n*   [Security](#security)\n*   [Contribute](#contribute)\n*   [Sponsor](#sponsor)\n*   [License](#license)\n\n## What is this?\n\nThis package is a [unified][] processor with support for parsing HTML as input\nand serializing HTML as output by using unified with\n[`rehype-parse`][rehype-parse] and [`rehype-stringify`][rehype-stringify].\n\nSee [the monorepo readme][rehype] for info on what the rehype ecosystem is.\n\n## When should I use this?\n\nYou can use this package when you want to use unified, have HTML as input, and\nwant HTML as output.\nThis package is a shortcut for\n`unified().use(rehypeParse).use(rehypeStringify)`.\nWhen the input isn’t HTML (meaning you don’t need `rehype-parse`) or the\noutput is not HTML (you don’t need `rehype-stringify`), it’s recommended to\nuse `unified` directly.\n\nWhen you’re in a browser, trust your content, don’t need positional info on\nnodes or formatting options, and value a smaller bundle size, you can use\n[`rehype-dom`][rehype-dom] instead.\n\nWhen you want to inspect and format HTML files in a project on the command\nline, you can use [`rehype-cli`][rehype-cli].\n\n## Install\n\nThis package is [ESM only][esm].\nIn Node.js (version 16+), install with [npm][]:\n\n```sh\nnpm install rehype\n```\n\nIn Deno with [`esm.sh`][esmsh]:\n\n```js\nimport {rehype} from 'https://esm.sh/rehype@13'\n```\n\nIn browsers with [`esm.sh`][esmsh]:\n\n```html\n<script type=\"module\">\n  import {rehype} from 'https://esm.sh/rehype@13?bundle'\n</script>\n```\n\n## Use\n\nSay we have the following module `example.js`:\n\n```js\nimport {rehype} from 'rehype'\nimport rehypeFormat from 'rehype-format'\n\nconst file = await rehype().use(rehypeFormat).process(`<!doctype html>\n        <html lang=en>\n<head>\n    <title>Hi!</title>\n  </head>\n  <body>\n    <h1>Hello!</h1>\n\n</body></html>`)\n\nconsole.error(String(file))\n```\n\n…running that with `node example.js` yields:\n\n```html\n<!doctype html>\n<html lang=\"en\">\n  <head>\n    <title>Hi!</title>\n  </head>\n  <body>\n    <h1>Hello!</h1>\n  </body>\n</html>\n```\n\n## API\n\nThis package exports the identifier [`rehype`][api-rehype].\nThere is no default export.\n\n### `rehype()`\n\nCreate a new unified processor that already uses\n[`rehype-parse`][rehype-parse] and [`rehype-stringify`][rehype-stringify].\n\nYou can add more plugins with `use`.\nSee [`unified`][unified] for more information.\n\n## Examples\n\n### Example: passing options to `rehype-parse`, `rehype-stringify`\n\nWhen you use `rehype-parse` or `rehype-stringify` manually you can pass options\ndirectly to them with `use`.\nBecause both plugins are already used in `rehype`, that’s not possible.\nTo define options for them, you can instead pass options to `data`:\n\n```js\nimport {rehype} from 'rehype'\nimport {reporter} from 'vfile-reporter'\n\nconst file = await rehype()\n  .data('settings', {\n    emitParseErrors: true,\n    fragment: true,\n    preferUnquoted: true\n  })\n  .process('<div title=\"a\" title=\"b\"></div>')\n\nconsole.error(reporter(file))\nconsole.log(String(file))\n```\n\n…yields:\n\n```txt\n1:21-1:21 warning Unexpected duplicate attribute duplicate-attribute hast-util-from-html\n\n⚠ 1 warning\n```\n\n```html\n<div title=a></div>\n```\n\n## Syntax\n\nHTML is parsed and serialized according to WHATWG HTML (the living standard),\nwhich is also followed by all browsers.\n\n## Syntax tree\n\nThe syntax tree format used in rehype is [hast][].\n\n## Types\n\nThis package is fully typed with [TypeScript][].\nIt exports no additional types.\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, `rehype@^13`, compatible\nwith 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\nUse of rehype plugins could also open you up to other attacks.\nCarefully assess each plugin and the risks involved in using them.\n\nFor info on how to submit a report, see our [security policy][security].\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## Sponsor\n\nSupport this effort and give back by sponsoring on [OpenCollective][collective]!\n\n<table>\n<tr valign=\"middle\">\n<td width=\"20%\" align=\"center\" rowspan=\"2\" colspan=\"2\">\n  <a href=\"https://vercel.com\">Vercel</a><br><br>\n  <a href=\"https://vercel.com\"><img src=\"https://avatars1.githubusercontent.com/u/14985020?s=256&v=4\" width=\"128\"></a>\n</td>\n<td width=\"20%\" align=\"center\" rowspan=\"2\" colspan=\"2\">\n  <a href=\"https://motif.land\">Motif</a><br><br>\n  <a href=\"https://motif.land\"><img src=\"https://avatars1.githubusercontent.com/u/74457950?s=256&v=4\" width=\"128\"></a>\n</td>\n<td width=\"20%\" align=\"center\" rowspan=\"2\" colspan=\"2\">\n  <a href=\"https://www.hashicorp.com\">HashiCorp</a><br><br>\n  <a href=\"https://www.hashicorp.com\"><img src=\"https://avatars1.githubusercontent.com/u/761456?s=256&v=4\" width=\"128\"></a>\n</td>\n<td width=\"20%\" align=\"center\" rowspan=\"2\" colspan=\"2\">\n  <a href=\"https://www.gitbook.com\">GitBook</a><br><br>\n  <a href=\"https://www.gitbook.com\"><img src=\"https://avatars1.githubusercontent.com/u/7111340?s=256&v=4\" width=\"128\"></a>\n</td>\n<td width=\"20%\" align=\"center\" rowspan=\"2\" colspan=\"2\">\n  <a href=\"https://www.gatsbyjs.org\">Gatsby</a><br><br>\n  <a href=\"https://www.gatsbyjs.org\"><img src=\"https://avatars1.githubusercontent.com/u/12551863?s=256&v=4\" width=\"128\"></a>\n</td>\n</tr>\n<tr valign=\"middle\">\n</tr>\n<tr valign=\"middle\">\n<td width=\"20%\" align=\"center\" rowspan=\"2\" colspan=\"2\">\n  <a href=\"https://www.netlify.com\">Netlify</a><br><br>\n  <!--OC has a sharper image-->\n  <a href=\"https://www.netlify.com\"><img src=\"https://images.opencollective.com/netlify/4087de2/logo/256.png\" width=\"128\"></a>\n</td>\n<td width=\"10%\" align=\"center\">\n  <a href=\"https://www.coinbase.com\">Coinbase</a><br><br>\n  <a href=\"https://www.coinbase.com\"><img src=\"https://avatars1.githubusercontent.com/u/1885080?s=256&v=4\" width=\"64\"></a>\n</td>\n<td width=\"10%\" align=\"center\">\n  <a href=\"https://themeisle.com\">ThemeIsle</a><br><br>\n  <a href=\"https://themeisle.com\"><img src=\"https://avatars1.githubusercontent.com/u/58979018?s=128&v=4\" width=\"64\"></a>\n</td>\n<td width=\"10%\" align=\"center\">\n  <a href=\"https://expo.io\">Expo</a><br><br>\n  <a href=\"https://expo.io\"><img src=\"https://avatars1.githubusercontent.com/u/12504344?s=128&v=4\" width=\"64\"></a>\n</td>\n<td width=\"10%\" align=\"center\">\n  <a href=\"https://boostnote.io\">Boost Note</a><br><br>\n  <a href=\"https://boostnote.io\"><img src=\"https://images.opencollective.com/boosthub/6318083/logo/128.png\" width=\"64\"></a>\n</td>\n<td width=\"10%\" align=\"center\">\n  <a href=\"https://markdown.space\">Markdown Space</a><br><br>\n  <a href=\"https://markdown.space\"><img src=\"https://images.opencollective.com/markdown-space/e1038ed/logo/128.png\" width=\"64\"></a>\n</td>\n<td width=\"10%\" align=\"center\">\n  <a href=\"https://www.holloway.com\">Holloway</a><br><br>\n  <a href=\"https://www.holloway.com\"><img src=\"https://avatars1.githubusercontent.com/u/35904294?s=128&v=4\" width=\"64\"></a>\n</td>\n<td width=\"10%\"></td>\n<td width=\"10%\"></td>\n</tr>\n<tr valign=\"middle\">\n<td width=\"100%\" align=\"center\" colspan=\"8\">\n  <br>\n  <a href=\"https://opencollective.com/unified\"><strong>You?</strong></a>\n  <br><br>\n</td>\n</tr>\n</table>\n\n## License\n\n[MIT][license] © [Titus Wormer][author]\n\n<!-- Definitions -->\n\n[build-badge]: https://github.com/rehypejs/rehype/workflows/main/badge.svg\n\n[build]: https://github.com/rehypejs/rehype/actions\n\n[coverage-badge]: https://img.shields.io/codecov/c/github/rehypejs/rehype.svg\n\n[coverage]: https://codecov.io/github/rehypejs/rehype\n\n[downloads-badge]: https://img.shields.io/npm/dm/rehype.svg\n\n[downloads]: https://www.npmjs.com/package/rehype\n\n[size-badge]: https://img.shields.io/bundlejs/size/rehype\n\n[size]: https://bundlejs.com/?q=rehype\n\n[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg\n\n[backers-badge]: https://opencollective.com/unified/backers/badge.svg\n\n[collective]: https://opencollective.com/unified\n\n[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg\n\n[chat]: https://github.com/rehypejs/rehype/discussions\n\n[health]: https://github.com/rehypejs/.github\n\n[security]: https://github.com/rehypejs/.github/blob/main/security.md\n\n[contributing]: https://github.com/rehypejs/.github/blob/main/contributing.md\n\n[support]: https://github.com/rehypejs/.github/blob/main/support.md\n\n[coc]: https://github.com/rehypejs/.github/blob/main/code-of-conduct.md\n\n[license]: https://github.com/rehypejs/rehype/blob/main/license\n\n[author]: https://wooorm.com\n\n[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c\n\n[npm]: https://docs.npmjs.com/cli/install\n\n[esmsh]: https://esm.sh\n\n[unified]: https://github.com/unifiedjs/unified\n\n[rehype]: https://github.com/rehypejs/rehype\n\n[hast]: https://github.com/syntax-tree/hast\n\n[xss]: https://en.wikipedia.org/wiki/Cross-site_scripting\n\n[typescript]: https://www.typescriptlang.org\n\n[rehype-parse]: ../rehype-parse/\n\n[rehype-stringify]: ../rehype-stringify/\n\n[rehype-cli]: ../rehype-cli/\n\n[rehype-sanitize]: https://github.com/rehypejs/rehype-sanitize\n\n[rehype-dom]: https://github.com/rehypejs/rehype-dom/tree/main/packages/rehype-dom\n\n[api-rehype]: #rehype-1\n","publish_time":1693041468081,"_cnpm_publish_time":1693041468081,"dist-tags":{"latest":"13.0.2"}}