{"name":"remark-rehype","version":"2.0.0","description":"rehype support for remark","license":"MIT","keywords":["remark","rehype","mdast","hast"],"repository":{"type":"git","url":"git+https://github.com/wooorm/remark-rehype.git"},"bugs":{"url":"https://github.com/wooorm/remark-rehype/issues"},"author":{"name":"Titus Wormer","email":"tituswormer@gmail.com","url":"http://wooorm.com"},"contributors":[{"name":"Titus Wormer","email":"tituswormer@gmail.com","url":"http://wooorm.com"}],"dependencies":{"mdast-util-to-hast":"^2.2.0"},"files":["index.js"],"devDependencies":{"browserify":"^14.1.0","esmangle":"^1.0.1","nyc":"^10.0.0","rehype-stringify":"^3.0.0","remark-cli":"^3.0.0","remark-parse":"^3.0.0","remark-preset-wooorm":"^2.0.0","remark-stringify":"^3.0.0","tape":"^4.0.0","unified":"^6.0.0","xo":"^0.17.1"},"scripts":{"build-md":"remark . -qfo","build-bundle":"browserify index.js --bare -s remarkRehype > remark-rehype.js","build-mangle":"esmangle remark-rehype.js > remark-rehype.min.js","build":"npm run build-md && npm run build-bundle && npm run build-mangle","lint":"xo","test-api":"node test.js","test-coverage":"nyc --reporter lcov tape test.js","test":"npm run build && npm run lint && npm run test-coverage"},"nyc":{"check-coverage":true,"lines":100,"functions":100,"branches":100},"xo":{"space":true,"ignores":["remark-rehype.js"]},"remarkConfig":{"plugins":["preset-wooorm"]},"gitHead":"9ac293f5e17737ebf592ba4b3d20ba154f0f6c66","homepage":"https://github.com/wooorm/remark-rehype#readme","_id":"remark-rehype@2.0.0","_shasum":"f8e02286715bbf1eeafa8c229150d7023ae3cc3c","_from":".","_npmVersion":"4.0.3","_nodeVersion":"7.0.0","_npmUser":{"name":"wooorm","email":"tituswormer@gmail.com"},"dist":{"shasum":"f8e02286715bbf1eeafa8c229150d7023ae3cc3c","tarball":"http://registry-npm.ywwl.com/remark-rehype/download/remark-rehype-2.0.0.tgz","integrity":"sha512-N0tgZR8FlsMAzmzPvgpQOw4NiLNukcAYPVm9Bq0xi0KZRaaXwJBmq5urFu2qqOlfCnslbQNJfQRDe2swkPZS5Q==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIC4e+YzSY0Z00vn0Kmn6c1pbS8kaFc8UHsYquXz6ghn1AiAWFgQd/V/LuRKeuanCEOPkqk9IaATmNyTfaIKvFVvmaw=="}],"size":2768,"noattachment":false,"key":"/remark-rehype/-/remark-rehype-2.0.0.tgz"},"maintainers":[{"name":"wooorm","email":"tituswormer@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/remark-rehype-2.0.0.tgz_1487885780795_0.25391096039675176"},"directories":{},"readme":"# remark-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**[remark][]** plugin that turns markdown into HTML to support **[rehype][]**.\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    *   [`defaultFootnoteBackContent(referenceIndex, rereferenceIndex)`](#defaultfootnotebackcontentreferenceindex-rereferenceindex)\n    *   [`defaultFootnoteBackLabel(referenceIndex, rereferenceIndex)`](#defaultfootnotebacklabelreferenceindex-rereferenceindex)\n    *   [`defaultHandlers`](#defaulthandlers)\n    *   [`unified().use(remarkRehype[, destination][, options])`](#unifieduseremarkrehype-destination-options)\n    *   [`Options`](#options)\n*   [Examples](#examples)\n    *   [Example: supporting HTML in markdown naïvely](#example-supporting-html-in-markdown-naïvely)\n    *   [Example: supporting HTML in markdown properly](#example-supporting-html-in-markdown-properly)\n    *   [Example: footnotes in languages other than English](#example-footnotes-in-languages-other-than-english)\n*   [HTML](#html-1)\n*   [CSS](#css)\n*   [Syntax tree](#syntax-tree)\n*   [Types](#types)\n*   [Compatibility](#compatibility)\n*   [Security](#security)\n*   [Related](#related)\n*   [Contribute](#contribute)\n*   [License](#license)\n\n## What is this?\n\nThis package is a [unified][] ([remark][]) plugin that switches from remark (the\nmarkdown ecosystem) to rehype (the HTML ecosystem).\nIt does this by transforming the current markdown (mdast) syntax tree into an\nHTML (hast) syntax tree.\nremark plugins deal with mdast and rehype plugins deal with hast, so plugins\nused after `remark-rehype` have to be rehype plugins.\n\nThe reason that there are different ecosystems for markdown and HTML is that\nturning markdown into HTML is, while frequently needed, not the only purpose of\nmarkdown.\nChecking (linting) and formatting markdown are also common use cases for\nremark and markdown.\nThere are several aspects of markdown that do not translate 1-to-1 to HTML.\nIn some cases markdown contains more information than HTML: for example, there\nare several ways to add a link in markdown (as in, autolinks: `<https://url>`,\nresource links: `[label](url)`, and reference links with definitions:\n`[label][id]` and `[id]: url`).\nIn other cases HTML contains more information than markdown: there are many\ntags, which add new meaning (semantics), available in HTML that aren’t available\nin markdown.\nIf there was just one AST, it would be quite hard to perform the tasks that\nseveral remark and rehype plugins currently do.\n\n## When should I use this?\n\nThis project is useful when you want to turn markdown to HTML.\nIt opens up a whole new ecosystem with tons of plugins to do all kinds of\nthings.\nYou can [minify HTML][rehype-minify], [format HTML][rehype-format],\n[make sure it’s safe][rehype-sanitize], [highlight code][rehype-highlight],\n[add metadata][rehype-meta], and a lot more.\n\nA different plugin, [`rehype-raw`][rehype-raw], adds support for raw HTML\nwritten inside markdown.\nThis is a separate plugin because supporting HTML inside markdown is a heavy\ntask (performance and bundle size) and not always needed.\nTo use both together, you also have to configure `remark-rehype` with\n`allowDangerousHtml: true` and then use `rehype-raw`.\n\nThe rehype plugin [`rehype-remark`][rehype-remark] does the inverse of this\nplugin.\nIt turns HTML into markdown.\n\nIf you don’t use plugins and want to access syntax trees, you can use\n[`mdast-util-to-hast`][mdast-util-to-hast].\n\n## Install\n\nThis package is [ESM only][esm].\nIn Node.js (version 16+), install with [npm][]:\n\n```sh\nnpm install remark-rehype\n```\n\nIn Deno with [`esm.sh`][esmsh]:\n\n```js\nimport remarkRehype from 'https://esm.sh/remark-rehype@11'\n```\n\nIn browsers with [`esm.sh`][esmsh]:\n\n```html\n<script type=\"module\">\n  import remarkRehype from 'https://esm.sh/remark-rehype@11?bundle'\n</script>\n```\n\n## Use\n\nSay our document `example.md` contains:\n\n```markdown\n# Pluto\n\n**Pluto** (minor-planet designation: **134340 Pluto**) is a\n[dwarf planet](https://en.wikipedia.org/wiki/Dwarf_planet) in the\n[Kuiper belt](https://en.wikipedia.org/wiki/Kuiper_belt).\n```\n\n…and our module `example.js` contains:\n\n```js\nimport rehypeDocument from 'rehype-document'\nimport rehypeFormat from 'rehype-format'\nimport rehypeStringify from 'rehype-stringify'\nimport remarkParse from 'remark-parse'\nimport remarkRehype from 'remark-rehype'\nimport {read} from 'to-vfile'\nimport {unified} from 'unified'\nimport {reporter} from 'vfile-reporter'\n\nconst file = await unified()\n  .use(remarkParse)\n  .use(remarkRehype)\n  .use(rehypeDocument)\n  .use(rehypeFormat)\n  .use(rehypeStringify)\n  .process(await read('example.md'))\n\nconsole.error(reporter(file))\nconsole.log(String(file))\n```\n\n…then running `node example.js` yields:\n\n```txt\nexample.md: no issues found\n```\n\n```html\n<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"utf-8\">\n    <title>example</title>\n    <meta content=\"width=device-width, initial-scale=1\" name=\"viewport\">\n  </head>\n  <body>\n    <h1>Pluto</h1>\n    <p>\n      <strong>Pluto</strong> (minor-planet designation: <strong>134340 Pluto</strong>) is a\n      <a href=\"https://en.wikipedia.org/wiki/Dwarf_planet\">dwarf planet</a> in the\n      <a href=\"https://en.wikipedia.org/wiki/Kuiper_belt\">Kuiper belt</a>.\n    </p>\n  </body>\n</html>\n```\n\n## API\n\nThis package exports the identifiers\n[`defaultFootnoteBackContent`][api-default-footnote-back-content],\n[`defaultFootnoteBackLabel`][api-default-footnote-back-label], and\n[`defaultHandlers`][api-default-handlers].\nThe default export is [`remarkRehype`][api-remark-rehype].\n\n### `defaultFootnoteBackContent(referenceIndex, rereferenceIndex)`\n\nSee [`defaultFootnoteBackContent` from\n`mdast-util-to-hast`][mdast-util-to-hast-default-footnote-back-content]\n\n### `defaultFootnoteBackLabel(referenceIndex, rereferenceIndex)`\n\nSee [`defaultFootnoteBackLabel` from\n`mdast-util-to-hast`][mdast-util-to-hast-default-footnote-back-label]\n\n### `defaultHandlers`\n\nSee [`defaultHandlers` from\n`mdast-util-to-hast`][mdast-util-to-hast-default-handlers]\n\n### `unified().use(remarkRehype[, destination][, options])`\n\nTurn markdown into HTML.\n\n###### Parameters\n\n*   `destination` ([`Processor`][unified-processor], optional)\n    — processor\n*   `options` ([`Options`][api-options], optional)\n    — configuration\n\n###### Returns\n\nTransform ([`Transformer`][unified-transformer]).\n\n##### Notes\n\n###### Signature\n\n*   if a [processor][unified-processor] is given, runs the (rehype) plugins\n    used on it with a hast tree, then discards the result\n    ([*bridge mode*][unified-mode])\n*   otherwise, returns a hast tree, the plugins used after `remarkRehype`\n    are rehype plugins ([*mutate mode*][unified-mode])\n\n> 👉 **Note**: It’s highly unlikely that you want to pass a `processor`.\n\n###### HTML\n\nRaw HTML is available in mdast as [`html`][mdast-html] nodes and can be embedded\nin hast as semistandard `raw` nodes.\nMost plugins ignore `raw` nodes but two notable ones don’t:\n\n*   [`rehype-stringify`][rehype-stringify] also has an option\n    `allowDangerousHtml` which will output the raw HTML.\n    This is typically discouraged as noted by the option name but is useful if\n    you completely trust authors\n*   [`rehype-raw`][rehype-raw] can handle the raw embedded HTML strings by\n    parsing them into standard hast nodes (`element`, `text`, etc).\n    This is a heavy task as it needs a full HTML parser, but it is the only way\n    to support untrusted content\n\n###### Footnotes\n\nMany options supported here relate to footnotes.\nFootnotes are not specified by CommonMark, which we follow by default.\nThey are supported by GitHub, so footnotes can be enabled in markdown with\n[`remark-gfm`][remark-gfm].\n\nThe options `footnoteBackLabel` and `footnoteLabel` define natural language\nthat explains footnotes, which is hidden for sighted users but shown to\nassistive technology.\nWhen your page is not in English, you must define translated values.\n\nBack references use ARIA attributes, but the section label itself uses a\nheading that is hidden with an `sr-only` class.\nTo show it to sighted users, define different attributes in\n`footnoteLabelProperties`.\n\n###### Clobbering\n\nFootnotes introduces a problem, as it links footnote calls to footnote\ndefinitions on the page through `id` attributes generated from user content,\nwhich results in DOM clobbering.\n\nDOM clobbering is this:\n\n```html\n<p id=x></p>\n<script>alert(x) // `x` now refers to the DOM `p#x` element</script>\n```\n\nElements by their ID are made available by browsers on the `window` object,\nwhich is a security risk.\nUsing a prefix solves this problem.\n\nMore information on how to handle clobbering and the prefix is explained in\n[*Example: headings (DOM clobbering)* in\n`rehype-sanitize`][rehype-sanitize-clobber].\n\n###### Unknown nodes\n\nUnknown nodes are nodes with a type that isn’t in `handlers` or `passThrough`.\nThe default behavior for unknown nodes is:\n\n*   when the node has a `value` (and doesn’t have `data.hName`,\n    `data.hProperties`, or `data.hChildren`, see later), create a hast `text`\n    node\n*   otherwise, create a `<div>` element (which could be changed with\n    `data.hName`), with its children mapped from mdast to hast as well\n\nThis behavior can be changed by passing an `unknownHandler`.\n\n### `Options`\n\nConfiguration (TypeScript type).\n\n###### Fields\n\n*   `allowDangerousHtml` (`boolean`, default: `false`)\n    — whether to persist raw HTML in markdown in the hast tree\n*   `clobberPrefix` (`string`, default: `'user-content-'`)\n    — prefix to use before the `id` property on footnotes to prevent them from\n    *clobbering*\n*   `footnoteBackContent`\n    ([`FootnoteBackContentTemplate` from\n    `mdast-util-to-hast`][mdast-util-to-hast-footnote-back-content-template]\n    or `string`, default:\n    [`defaultFootnoteBackContent` from\n    `mdast-util-to-hast`][mdast-util-to-hast-default-footnote-back-content])\n    — content of the backreference back to references\n*   `footnoteBackLabel`\n    ([`FootnoteBackLabelTemplate` from\n    `mdast-util-to-hast`][mdast-util-to-hast-footnote-back-label-template]\n    or `string`, default:\n    [`defaultFootnoteBackLabel` from\n    `mdast-util-to-hast`][mdast-util-to-hast-default-footnote-back-label])\n    — label to describe the backreference back to references\n*   `footnoteLabel` (`string`, default: `'Footnotes'`)\n    — label to use for the footnotes section (affects screen readers)\n*   `footnoteLabelProperties`\n    ([`Properties` from `@types/hast`][hast-properties], default:\n    `{className: ['sr-only']}`)\n    — properties to use on the footnote label\n    (note that `id: 'footnote-label'` is always added as footnote calls use it\n    with `aria-describedby` to provide an accessible label)\n*   `footnoteLabelTagName` (`string`, default: `h2`)\n    — tag name to use for the footnote label\n*   `handlers` ([`Handlers` from\n    `mdast-util-to-hast`][mdast-util-to-hast-handlers], optional)\n    — extra handlers for nodes\n*   `passThrough` (`Array<Nodes['type']>`, optional)\n    — list of custom mdast node types to pass through (keep) in hast (note that\n    the node itself is passed, but eventual children are transformed)\n*   `unknownHandler` ([`Handler` from\n    `mdast-util-to-hast`][mdast-util-to-hast-handler], optional)\n    — handle all unknown nodes\n\n## Examples\n\n### Example: supporting HTML in markdown naïvely\n\nIf you completely trust the authors of the input markdown and want to allow them\nto write HTML inside markdown, you can pass `allowDangerousHtml` to\n`remark-rehype` and `rehype-stringify`:\n\n```js\nimport rehypeStringify from 'rehype-stringify'\nimport remarkParse from 'remark-parse'\nimport remarkRehype from 'remark-rehype'\nimport {unified} from 'unified'\n\nconst file = await unified()\n  .use(remarkParse)\n  .use(remarkRehype, {allowDangerousHtml: true})\n  .use(rehypeStringify, {allowDangerousHtml: true})\n  .process('<a href=\"/wiki/Dysnomia_(moon)\" onclick=\"alert(1)\">Dysnomia</a>')\n\nconsole.log(String(file))\n```\n\nYields:\n\n```html\n<p><a href=\"/wiki/Dysnomia_(moon)\" onclick=\"alert(1)\">Dysnomia</a></p>\n```\n\n> ⚠️ **Danger**: observe that the XSS attack through `onclick` is present.\n\n### Example: supporting HTML in markdown properly\n\nIf you do not trust the authors of the input markdown, or if you want to make\nsure that rehype plugins can see HTML embedded in markdown, use\n[`rehype-raw`][rehype-raw].\nThe following example passes `allowDangerousHtml` to `remark-rehype`, then\nturns the raw embedded HTML into proper HTML nodes with `rehype-raw`, and\nfinally sanitizes the HTML by only allowing safe things with\n`rehype-sanitize`:\n\n```js\nimport rehypeSanitize from 'rehype-sanitize'\nimport rehypeStringify from 'rehype-stringify'\nimport rehypeRaw from 'rehype-raw'\nimport remarkParse from 'remark-parse'\nimport remarkRehype from 'remark-rehype'\nimport {unified} from 'unified'\n\nconst file = await unified()\n  .use(remarkParse)\n  .use(remarkRehype, {allowDangerousHtml: true})\n  .use(rehypeRaw)\n  .use(rehypeSanitize)\n  .use(rehypeStringify)\n  .process('<a href=\"/wiki/Dysnomia_(moon)\" onclick=\"alert(1)\">Dysnomia</a>')\n\nconsole.log(String(file))\n```\n\nRunning that code yields:\n\n```html\n<p><a href=\"/wiki/Dysnomia_(moon)\">Dysnomia</a></p>\n```\n\n> ⚠️ **Danger**: observe that the XSS attack through `onclick` is **not**\n> present.\n\n### Example: footnotes in languages other than English\n\nIf you know that the markdown is authored in a language other than English,\nand you’re using `remark-gfm` to match how GitHub renders markdown, and you know\nthat footnotes are (or can?) be used, you should translate the labels associated\nwith them.\n\nLet’s first set the stage:\n\n```js\nimport {unified} from 'unified'\nimport remarkParse from 'remark-parse'\nimport remarkGfm from 'remark-gfm'\nimport remarkRehype from 'remark-rehype'\nimport rehypeStringify from 'rehype-stringify'\n\nconst doc = `\nCeres ist nach der römischen Göttin des Ackerbaus benannt;\nihr astronomisches Symbol ist daher eine stilisierte Sichel: ⚳.[^nasa-2015]\n\n[^nasa-2015]: JPL/NASA:\n    [*What is a Dwarf Planet?*](https://www.jpl.nasa.gov/infographics/what-is-a-dwarf-planet)\n    In: Jet Propulsion Laboratory.\n    22. April 2015,\n    abgerufen am 19. Januar 2022 (englisch).\n`\n\nconst file = await unified()\n  .use(remarkParse)\n  .use(remarkGfm)\n  .use(remarkRehype)\n  .use(rehypeStringify)\n  .process(doc)\n\nconsole.log(String(file))\n```\n\nYields:\n\n```html\n<p>Ceres ist nach der römischen Göttin des Ackerbaus benannt;\nihr astronomisches Symbol ist daher eine stilisierte Sichel: ⚳.<sup><a href=\"#user-content-fn-nasa-2015\" id=\"user-content-fnref-nasa-2015\" data-footnote-ref aria-describedby=\"footnote-label\">1</a></sup></p>\n<section data-footnotes class=\"footnotes\"><h2 class=\"sr-only\" id=\"footnote-label\">Footnotes</h2>\n<ol>\n<li id=\"user-content-fn-nasa-2015\">\n<p>JPL/NASA:\n<a href=\"https://www.jpl.nasa.gov/infographics/what-is-a-dwarf-planet\"><em>What is a Dwarf Planet?</em></a>\nIn: Jet Propulsion Laboratory.\n22. April 2015,\nabgerufen am 19. Januar 2022 (englisch). <a href=\"#user-content-fnref-nasa-2015\" data-footnote-backref=\"\" aria-label=\"Back to reference 1\" class=\"data-footnote-backref\">↩</a></p>\n</li>\n</ol>\n</section>\n```\n\nThis is a mix of English and German that isn’t very accessible, such as that\nscreen readers can’t handle it nicely.\nLet’s say our program *does* know that the markdown is in German.\nIn that case, it’s important to translate and define the labels relating to\nfootnotes so that screen reader users can properly pronounce the page:\n\n```diff\n@@ -18,7 +18,16 @@ ihr astronomisches Symbol ist daher eine stilisierte Sichel: ⚳.[^nasa-2015]\n const file = await unified()\n   .use(remarkParse)\n   .use(remarkGfm)\n-  .use(remarkRehype)\n+  .use(remarkRehype, {\n+    footnoteBackLabel(referenceIndex, rereferenceIndex) {\n+      return (\n+        'Hochspringen nach: ' +\n+        (referenceIndex + 1) +\n+        (rereferenceIndex > 1 ? '-' + rereferenceIndex : '')\n+      )\n+    },\n+    footnoteLabel: 'Fußnoten'\n+  })\n   .use(rehypeStringify)\n   .process(doc)\n```\n\nRunning the code with the above patch applied, yields:\n\n```diff\n@@ -1,13 +1,13 @@\n <p>Ceres ist nach der römischen Göttin des Ackerbaus benannt;\n ihr astronomisches Symbol ist daher eine stilisierte Sichel: ⚳.<sup><a href=\"#user-content-fn-nasa-2015\" id=\"user-content-fnref-nasa-2015\" data-footnote-ref aria-describedby=\"footnote-label\">1</a></sup></p>\n-<section data-footnotes class=\"footnotes\"><h2 class=\"sr-only\" id=\"footnote-label\">Footnotes</h2>\n+<section data-footnotes class=\"footnotes\"><h2 class=\"sr-only\" id=\"footnote-label\">Fußnoten</h2>\n <ol>\n <li id=\"user-content-fn-nasa-2015\">\n <p>JPL/NASA:\n <a href=\"https://www.jpl.nasa.gov/infographics/what-is-a-dwarf-planet\"><em>What is a Dwarf Planet?</em></a>\n In: Jet Propulsion Laboratory.\n 22. April 2015,\n-abgerufen am 19. Januar 2022 (englisch). <a href=\"#user-content-fnref-nasa-2015\" data-footnote-backref=\"\" aria-label=\"Back to reference 1\" class=\"data-footnote-backref\">↩</a></p>\n+abgerufen am 19. Januar 2022 (englisch). <a href=\"#user-content-fnref-nasa-2015\" data-footnote-backref=\"\" aria-label=\"Hochspringen nach: 1\" class=\"data-footnote-backref\">↩</a></p>\n </li>\n </ol>\n </section>\n```\n\n## HTML\n\nSee [*Algorithm* in\n`mdast-util-to-hast`](https://github.com/syntax-tree/mdast-util-to-hast#algorithm)\nfor info on how mdast (markdown) nodes are transformed to hast (HTML).\n\n## CSS\n\nAssuming you know how to use (semantic) HTML and CSS, then it should generally\nbe straightforward to style the HTML produced by this plugin.\nWith CSS, you can get creative and style the results as you please.\n\nSome semistandard features, notably GFMs tasklists and footnotes, generate HTML\nthat be unintuitive, as it matches exactly what GitHub produces for their\nwebsite.\nThere is a project, [`sindresorhus/github-markdown-css`][github-markdown-css],\nthat exposes the stylesheet that GitHub uses for rendered markdown, which might\neither be inspirational for more complex features, or can be used as-is to\nexactly match how GitHub styles rendered markdown.\n\nThe following CSS is needed to make footnotes look a bit like GitHub:\n\n```css\n/* Style the footnotes section. */\n.footnotes {\n  font-size: smaller;\n  color: #8b949e;\n  border-top: 1px solid #30363d;\n}\n\n/* Hide the section label for visual users. */\n.sr-only {\n  position: absolute;\n  width: 1px;\n  height: 1px;\n  padding: 0;\n  overflow: hidden;\n  clip: rect(0, 0, 0, 0);\n  word-wrap: normal;\n  border: 0;\n}\n\n/* Place `[` and `]` around footnote calls. */\n[data-footnote-ref]::before {\n  content: '[';\n}\n\n[data-footnote-ref]::after {\n  content: ']';\n}\n```\n\n## Syntax tree\n\nThis projects turns [mdast][] (markdown) into [hast][] (HTML).\n\nIt extends mdast by supporting `data` fields on mdast nodes to specify how they\nshould be transformed.\nSee [*Fields on nodes* in\n`mdast-util-to-hast`](https://github.com/syntax-tree/mdast-util-to-hast#fields-on-nodes)\nfor info on how these fields work.\n\nIt extends hast by using a semistandard raw nodes for raw HTML.\nSee the [*HTML* note above](#html) for more info.\n\n## Types\n\nThis package is fully typed with [TypeScript][].\nIt exports the types\n[`Options`][api-options].\n\nThe types of `mdast-util-to-hast` can be referenced to register data fields\nwith `@types/mdast` and `Raw` nodes with `@types/hast`.\n\n```js\n// Include `data` fields in mdast and `raw` nodes in hast.\n/// <reference types=\"mdast-util-to-hast\" />\n\nimport {visit} from 'unist-util-visit'\n\n/** @type {import('mdast').Root} */\nconst mdastNode = {/* … */}\nconsole.log(mdastNode.data?.hName) // Typed as `string | undefined`.\n\n/** @type {import('hast').Root} */\nconst hastNode = {/* … */}\n\nvisit(hastNode, function (node) {\n  // `node` can now be `raw`.\n})\n```\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, `remark-rehype@^11`,\ncompatible with Node.js 16.\n\nThis plugin works with `unified` version 6+, `remark-parse` version 3+ (used in\n`remark` version 7), and `rehype-stringify` version 3+ (used in `rehype`\nversion 5).\n\n## Security\n\nUse of `remark-rehype` can open you up to a\n[cross-site scripting (XSS)][wiki-xss] attack.\nEmbedded **[hast][]** properties (`hName`, `hProperties`, `hChildren`) in\n[mdast][], custom handlers, and the `allowDangerousHtml` option all provide\nopenings.\nUse [`rehype-sanitize`][rehype-sanitize] to make the tree safe.\n\n## Related\n\n*   [`rehype-raw`][rehype-raw]\n    — rehype plugin to parse the tree again and support `raw` nodes\n*   [`rehype-sanitize`][rehype-sanitize]\n    — rehype plugin to sanitize HTML\n*   [`rehype-remark`](https://github.com/rehypejs/rehype-remark)\n    — rehype plugin to turn HTML into markdown\n*   [`rehype-retext`](https://github.com/rehypejs/rehype-retext)\n    — rehype plugin to support retext\n*   [`remark-retext`](https://github.com/remarkjs/remark-retext)\n    — remark plugin to support retext\n\n## Contribute\n\nSee [`contributing.md`][contributing] in [`remarkjs/.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<!-- Definitions -->\n\n[build-badge]: https://github.com/remarkjs/remark-rehype/workflows/main/badge.svg\n\n[build]: https://github.com/remarkjs/remark-rehype/actions\n\n[coverage-badge]: https://img.shields.io/codecov/c/github/remarkjs/remark-rehype.svg\n\n[coverage]: https://codecov.io/github/remarkjs/remark-rehype\n\n[downloads-badge]: https://img.shields.io/npm/dm/remark-rehype.svg\n\n[downloads]: https://www.npmjs.com/package/remark-rehype\n\n[size-badge]: https://img.shields.io/bundlejs/size/remark-rehype\n\n[size]: https://bundlejs.com/?q=remark-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/remarkjs/remark/discussions\n\n[npm]: https://docs.npmjs.com/cli/install\n\n[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c\n\n[esmsh]: https://esm.sh\n\n[health]: https://github.com/remarkjs/.github\n\n[contributing]: https://github.com/remarkjs/.github/blob/main/contributing.md\n\n[support]: https://github.com/remarkjs/.github/blob/main/support.md\n\n[coc]: https://github.com/remarkjs/.github/blob/main/code-of-conduct.md\n\n[license]: license\n\n[author]: https://wooorm.com\n\n[github-markdown-css]: https://github.com/sindresorhus/github-markdown-css\n\n[hast]: https://github.com/syntax-tree/hast\n\n[hast-properties]: https://github.com/syntax-tree/hast#properties\n\n[mdast]: https://github.com/syntax-tree/mdast\n\n[mdast-html]: https://github.com/syntax-tree/mdast#html\n\n[mdast-util-to-hast]: https://github.com/syntax-tree/mdast-util-to-hast\n\n[mdast-util-to-hast-default-footnote-back-content]: https://github.com/syntax-tree/mdast-util-to-hast#defaultfootnotebackcontentreferenceindex-rereferenceindex\n\n[mdast-util-to-hast-default-footnote-back-label]: https://github.com/syntax-tree/mdast-util-to-hast#defaultfootnotebacklabelreferenceindex-rereferenceindex\n\n[mdast-util-to-hast-footnote-back-content-template]: https://github.com/syntax-tree/mdast-util-to-hast#footnotebackcontenttemplate\n\n[mdast-util-to-hast-footnote-back-label-template]: https://github.com/syntax-tree/mdast-util-to-hast#footnotebacklabeltemplate\n\n[mdast-util-to-hast-default-handlers]: https://github.com/syntax-tree/mdast-util-to-hast#defaulthandlers\n\n[mdast-util-to-hast-handlers]: https://github.com/syntax-tree/mdast-util-to-hast#handlers\n\n[mdast-util-to-hast-handler]: https://github.com/syntax-tree/mdast-util-to-hast#handler\n\n[rehype]: https://github.com/rehypejs/rehype\n\n[rehype-format]: https://github.com/rehypejs/rehype-format\n\n[rehype-highlight]: https://github.com/rehypejs/rehype-highlight\n\n[rehype-meta]: https://github.com/rehypejs/rehype-meta\n\n[rehype-minify]: https://github.com/rehypejs/rehype-minify\n\n[rehype-raw]: https://github.com/rehypejs/rehype-raw\n\n[rehype-sanitize]: https://github.com/rehypejs/rehype-sanitize\n\n[rehype-sanitize-clobber]: https://github.com/rehypejs/rehype-sanitize#example-headings-dom-clobbering\n\n[rehype-stringify]: https://github.com/rehypejs/rehype/tree/main/packages/rehype-stringify\n\n[rehype-remark]: https://github.com/rehypejs/rehype-remark\n\n[remark]: https://github.com/remarkjs/remark\n\n[remark-gfm]: https://github.com/remarkjs/remark-gfm\n\n[typescript]: https://www.typescriptlang.org\n\n[unified]: https://github.com/unifiedjs/unified\n\n[unified-mode]: https://github.com/unifiedjs/unified#transforming-between-ecosystems\n\n[unified-processor]: https://github.com/unifiedjs/unified#processor\n\n[unified-transformer]: https://github.com/unifiedjs/unified#transformer\n\n[wiki-xss]: https://en.wikipedia.org/wiki/Cross-site_scripting\n\n[api-default-footnote-back-content]: #defaultfootnotebackcontentreferenceindex-rereferenceindex\n\n[api-default-footnote-back-label]: #defaultfootnotebacklabelreferenceindex-rereferenceindex\n\n[api-default-handlers]: #defaulthandlers\n\n[api-options]: #options\n\n[api-remark-rehype]: #unifieduseremarkrehype-destination-options\n","publish_time":1487885782545,"_cnpm_publish_time":1487885782545,"dist-tags":{"latest":"11.1.2"}}