{"_id":"rehype-mdx-code-props","_rev":"3-7d99e2e4fd022fb24f15ee744db34d12","name":"rehype-mdx-code-props","description":"A rehype MDX plugin for interpreting markdown code meta as props","dist-tags":{"latest":"3.0.1"},"versions":{"1.0.0":{"name":"rehype-mdx-code-props","version":"1.0.0","keywords":["hast","html","markdown","mdx","rehype","rehype-plugin","unified"],"author":{"name":"Remco Haszing","email":"remcohaszing@gmail.com"},"license":"MIT","_id":"rehype-mdx-code-props@1.0.0","maintainers":[{"name":"remcohaszing","email":"remcohaszing@gmail.com"}],"homepage":"https://github.com/remcohaszing/rehype-mdx-code-props#readme","bugs":{"url":"https://github.com/remcohaszing/rehype-mdx-code-props/issues"},"dist":{"shasum":"c929d4a0910f11a9e3c641489481f0e2779726ed","tarball":"https://registry.npmjs.org/rehype-mdx-code-props/-/rehype-mdx-code-props-1.0.0.tgz","fileCount":5,"integrity":"sha512-NvHm7pTqIIfhpKmjNNizIIJzOcaRDvsAI2katLLylxX5DdhTw/sYKTKnvVZTungykXQglcYnlyVglsEuZ/jZxA==","signatures":[{"sig":"MEUCIQCf6bzILgDvQc4U/9D1DHubohbc9Y44TEEIpjGN/Pp36gIgF16X/YESL9MhBkU1sKU1QL5FnMCgVCHPdYu9hFfKzaU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/rehype-mdx-code-props@1.0.0","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":8066},"type":"module","_from":"file:rehype-mdx-code-props-1.0.0.tgz","types":"./index.d.ts","exports":"./index.js","funding":"https://github.com/sponsors/remcohaszing","scripts":{"test":"c8 tsx test.ts","start":"tsx watch test.ts","prepack":"tsc --noEmit false"},"_npmUser":{"name":"remcohaszing","email":"remcohaszing@gmail.com"},"_resolved":"/home/runner/work/rehype-mdx-code-props/rehype-mdx-code-props/rehype-mdx-code-props-1.0.0.tgz","_integrity":"sha512-NvHm7pTqIIfhpKmjNNizIIJzOcaRDvsAI2katLLylxX5DdhTw/sYKTKnvVZTungykXQglcYnlyVglsEuZ/jZxA==","repository":{"url":"git+https://github.com/remcohaszing/rehype-mdx-code-props.git","type":"git"},"_npmVersion":"9.6.6","description":"A rehype MDX plugin for interpreting markdown code meta as props","directories":{},"_nodeVersion":"20.2.0","dependencies":{"acorn":"^8.0.0","unified":"^10.0.0","acorn-jsx":"^5.0.0","@types/hast":"^2.0.0","hast-util-to-estree":"^2.0.0","unist-util-visit-parents":"^5.0.0"},"_hasShrinkwrap":false,"devDependencies":{"c8":"^7.0.0","tsx":"^3.0.0","eslint":"^8.0.0","prettier":"^2.0.0","to-vfile":"^7.0.0","remark-cli":"11.0.0","typescript":"^5.0.0","@mdx-js/mdx":"^2.0.0","@types/node":"^20.0.0","@types/estree":"^1.0.0","@types/prettier":"^2.0.0","eslint-config-remcohaszing":"^9.0.0","remark-preset-remcohaszing":"^1.0.0"},"_npmOperationalInternal":{"tmp":"tmp/rehype-mdx-code-props_1.0.0_1685476804003_0.06703458859546019","host":"s3://npm-registry-packages"}},"2.0.0":{"name":"rehype-mdx-code-props","version":"2.0.0","keywords":["hast","html","markdown","mdx","rehype","rehype-plugin","unified"],"author":{"name":"Remco Haszing","email":"remcohaszing@gmail.com"},"license":"MIT","_id":"rehype-mdx-code-props@2.0.0","maintainers":[{"name":"remcohaszing","email":"remcohaszing@gmail.com"}],"homepage":"https://github.com/remcohaszing/rehype-mdx-code-props#readme","bugs":{"url":"https://github.com/remcohaszing/rehype-mdx-code-props/issues"},"dist":{"shasum":"35af259ec84b0476cd2454103a9b790536ce4ae3","tarball":"https://registry.npmjs.org/rehype-mdx-code-props/-/rehype-mdx-code-props-2.0.0.tgz","fileCount":5,"integrity":"sha512-dGjba9oF6DrY6xKDxOuiHp2BtaWaF7hNhxPbtzDcPqRNRjw8fNhRD5Geqf8X8HRowzkykOJkqEX03CKYVpsHTw==","signatures":[{"sig":"MEYCIQD4tBmHQTMkTXP7IandFHfagzIVVxTmFdT3fetMaZyJ3gIhAK0ARzLLcx33vt3Z8QwHkcfUAcxObXxawmg9AX2qvtHT","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/rehype-mdx-code-props@2.0.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":8164},"type":"module","_from":"file:rehype-mdx-code-props-2.0.0.tgz","types":"./index.d.ts","exports":"./index.js","funding":"https://github.com/sponsors/remcohaszing","scripts":{"test":"c8 tsx test.ts","start":"tsx watch test.ts","prepack":"tsc --noEmit false"},"_npmUser":{"name":"remcohaszing","email":"remcohaszing@gmail.com"},"_resolved":"/home/runner/work/rehype-mdx-code-props/rehype-mdx-code-props/rehype-mdx-code-props-2.0.0.tgz","_integrity":"sha512-dGjba9oF6DrY6xKDxOuiHp2BtaWaF7hNhxPbtzDcPqRNRjw8fNhRD5Geqf8X8HRowzkykOJkqEX03CKYVpsHTw==","repository":{"url":"git+https://github.com/remcohaszing/rehype-mdx-code-props.git","type":"git"},"_npmVersion":"10.1.0","description":"A rehype MDX plugin for interpreting markdown code meta as props","directories":{},"_nodeVersion":"20.9.0","dependencies":{"acorn":"^8.0.0","unified":"^11.0.0","acorn-jsx":"^5.0.0","@types/hast":"^3.0.0","hast-util-to-estree":"^3.0.0","unist-util-visit-parents":"^6.0.0"},"_hasShrinkwrap":false,"devDependencies":{"c8":"^8.0.0","tsx":"^3.0.0","eslint":"^8.0.0","prettier":"^3.0.0","to-vfile":"^8.0.0","remark-cli":"11.0.0","typescript":"^5.0.0","@mdx-js/mdx":"^3.0.0","@types/node":"^20.0.0","@types/estree":"^1.0.0","eslint-plugin-react":"^7.0.0","eslint-plugin-jsx-a11y":"^6.0.0","eslint-config-remcohaszing":"^10.0.0","remark-preset-remcohaszing":"^2.0.0"},"_npmOperationalInternal":{"tmp":"tmp/rehype-mdx-code-props_2.0.0_1698681548551_0.13832283966337","host":"s3://npm-registry-packages"}},"3.0.0":{"name":"rehype-mdx-code-props","version":"3.0.0","keywords":["hast","html","markdown","mdx","rehype","rehype-plugin","unified"],"author":{"name":"Remco Haszing","email":"remcohaszing@gmail.com"},"license":"MIT","_id":"rehype-mdx-code-props@3.0.0","maintainers":[{"name":"remcohaszing","email":"remcohaszing@gmail.com"}],"homepage":"https://github.com/remcohaszing/rehype-mdx-code-props#readme","bugs":{"url":"https://github.com/remcohaszing/rehype-mdx-code-props/issues"},"dist":{"shasum":"0ddca49ad30955058d360689aa67cffa953515f6","tarball":"https://registry.npmjs.org/rehype-mdx-code-props/-/rehype-mdx-code-props-3.0.0.tgz","fileCount":8,"integrity":"sha512-Nw8gFlrc51tK+5jz9XhI31J6lniGLpgyM0xIYteDHWEx0rlqosguVMasSMiQXkjov19j66mP9fgl09iCV+AYTA==","signatures":[{"sig":"MEQCIGnPGVXhmv+dezPwIEUYAQCtGdrPpOKd7BeCp4fw0Zg4AiASjpP5yBeNQSv71F2JYwC3RaYNfsNDIObYQg8i4OXK+w==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/rehype-mdx-code-props@3.0.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":19189},"main":"./dist/rehype-mdx-code-props.js","type":"module","_from":"file:rehype-mdx-code-props-3.0.0.tgz","types":"./dist/rehype-mdx-code-props.d.ts","exports":"./dist/rehype-mdx-code-props.js","funding":"https://github.com/sponsors/remcohaszing","scripts":{"test":"c8 node --enable-source-maps dist/test.js","prepack":"tsc --build","pretest":"tsc --build"},"_npmUser":{"name":"remcohaszing","email":"remcohaszing@gmail.com"},"_resolved":"/home/runner/work/rehype-mdx-code-props/rehype-mdx-code-props/rehype-mdx-code-props-3.0.0.tgz","_integrity":"sha512-Nw8gFlrc51tK+5jz9XhI31J6lniGLpgyM0xIYteDHWEx0rlqosguVMasSMiQXkjov19j66mP9fgl09iCV+AYTA==","repository":{"url":"git+https://github.com/remcohaszing/rehype-mdx-code-props.git","type":"git"},"_npmVersion":"10.2.4","description":"A rehype MDX plugin for interpreting markdown code meta as props","directories":{},"_nodeVersion":"20.11.1","dependencies":{"unified":"^11.0.0","@types/hast":"^3.0.0","style-to-js":"^1.0.0","mdast-util-mdx":"^3.0.0","property-information":"^6.0.0","comma-separated-tokens":"^2.0.0","space-separated-tokens":"^2.0.0","mdast-util-from-markdown":"^2.0.0","unist-util-visit-parents":"^6.0.0","micromark-extension-mdxjs":"^3.0.0","estree-util-value-to-estree":"^3.0.0"},"_hasShrinkwrap":false,"devDependencies":{"c8":"^9.0.0","eslint":"^8.0.0","prettier":"^3.0.0","to-vfile":"^8.0.0","remark-cli":"11.0.0","typescript":"^5.0.0","@mdx-js/mdx":"^3.0.0","@types/node":"^20.0.0","@types/react":"^18.0.0","mdast-util-mdx-jsx":"^3.0.0","eslint-plugin-react":"^7.0.0","eslint-plugin-jsx-a11y":"^6.0.0","eslint-config-remcohaszing":"^10.0.0","remark-preset-remcohaszing":"^2.0.0"},"_npmOperationalInternal":{"tmp":"tmp/rehype-mdx-code-props_3.0.0_1710756633062_0.6325305256221156","host":"s3://npm-registry-packages"}},"3.0.1":{"name":"rehype-mdx-code-props","version":"3.0.1","description":"A rehype MDX plugin for interpreting markdown code meta as props","author":{"name":"Remco Haszing","email":"remcohaszing@gmail.com"},"license":"MIT","type":"module","main":"./dist/rehype-mdx-code-props.js","exports":"./dist/rehype-mdx-code-props.js","repository":{"type":"git","url":"git+https://github.com/remcohaszing/rehype-mdx-code-props.git"},"bugs":{"url":"https://github.com/remcohaszing/rehype-mdx-code-props/issues"},"homepage":"https://github.com/remcohaszing/rehype-mdx-code-props#readme","funding":"https://github.com/sponsors/remcohaszing","keywords":["hast","html","markdown","mdx","rehype","rehype-plugin","unified"],"scripts":{"prepack":"tsc --build","pretest":"tsc --build","test":"c8 node --enable-source-maps dist/test.js"},"dependencies":{"@types/hast":"^3.0.0","hast-util-properties-to-mdx-jsx-attributes":"^1.0.0","mdast-util-from-markdown":"^2.0.0","mdast-util-mdx":"^3.0.0","micromark-extension-mdxjs":"^3.0.0","unified":"^11.0.0","unist-util-visit-parents":"^6.0.0"},"devDependencies":{"@mdx-js/mdx":"^3.0.0","@types/node":"^20.0.0","@types/react":"^18.0.0","c8":"^9.0.0","eslint":"^8.0.0","eslint-config-remcohaszing":"^10.0.0","eslint-plugin-jsx-a11y":"^6.0.0","eslint-plugin-react":"^7.0.0","mdast-util-mdx-jsx":"^3.0.0","prettier":"^3.0.0","remark-cli":"12.0.0","remark-preset-remcohaszing":"^3.0.0","snapshot-fixtures":"^1.0.0","typescript":"^5.0.0"},"_id":"rehype-mdx-code-props@3.0.1","types":"./dist/rehype-mdx-code-props.d.ts","_integrity":"sha512-BWWKn0N6r7/qd7lbLgv5J8of7imz1l1PyCNoY7BH0AOR9JdJlQIfA9cKqTZVEb2h2GPKh473qrBajF0i01fq3A==","_resolved":"/home/runner/work/rehype-mdx-code-props/rehype-mdx-code-props/rehype-mdx-code-props-3.0.1.tgz","_from":"file:rehype-mdx-code-props-3.0.1.tgz","_nodeVersion":"20.14.0","_npmVersion":"10.7.0","dist":{"integrity":"sha512-BWWKn0N6r7/qd7lbLgv5J8of7imz1l1PyCNoY7BH0AOR9JdJlQIfA9cKqTZVEb2h2GPKh473qrBajF0i01fq3A==","shasum":"213c1afaf755353ab3101eef72d053180a1ed4e7","tarball":"https://registry.npmjs.org/rehype-mdx-code-props/-/rehype-mdx-code-props-3.0.1.tgz","fileCount":8,"unpackedSize":13497,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/rehype-mdx-code-props@3.0.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCtKV+VUIGMnO9ttv56gxOZXkCOvDHNFJjyNW3J6wnKOAIhAOP1beD60j5ZyRig6AFJHDIpPtsEqKNdK5/NsPPbzaNs"}]},"_npmUser":{"name":"remcohaszing","email":"remcohaszing@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/rehype-mdx-code-props_3.0.1_1718984867501_0.4538646438790861"},"_hasShrinkwrap":false}},"time":{"created":"2023-05-30T20:00:03.944Z","modified":"2024-06-21T15:47:48.141Z","1.0.0":"2023-05-30T20:00:04.270Z","2.0.0":"2023-10-30T15:59:08.703Z","3.0.0":"2024-03-18T10:10:33.254Z","3.0.1":"2024-06-21T15:47:47.760Z"},"maintainers":[{"name":"remcohaszing","email":"remcohaszing@gmail.com"}],"author":{"name":"Remco Haszing","email":"remcohaszing@gmail.com"},"repository":{"type":"git","url":"git+https://github.com/remcohaszing/rehype-mdx-code-props.git"},"keywords":["hast","html","markdown","mdx","rehype","rehype-plugin","unified"],"license":"MIT","homepage":"https://github.com/remcohaszing/rehype-mdx-code-props#readme","bugs":{"url":"https://github.com/remcohaszing/rehype-mdx-code-props/issues"},"readme":"# rehype-mdx-code-props\n\n[![github actions](https://github.com/remcohaszing/rehype-mdx-code-props/actions/workflows/ci.yaml/badge.svg)](https://github.com/remcohaszing/rehype-mdx-code-props/actions/workflows/ci.yaml)\n[![codecov](https://codecov.io/gh/remcohaszing/rehype-mdx-code-props/branch/main/graph/badge.svg)](https://codecov.io/gh/remcohaszing/rehype-mdx-code-props)\n[![npm version](https://img.shields.io/npm/v/rehype-mdx-code-props)](https://www.npmjs.com/package/rehype-mdx-code-props)\n[![npm downloads](https://img.shields.io/npm/dm/rehype-mdx-code-props)](https://www.npmjs.com/package/rehype-mdx-code-props)\n\nA [rehype](https://github.com/rehypejs/rehype) [MDX](https://mdxjs.com) plugin for interpreting\nmarkdown code meta as props.\n\n## Table of Contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [API](#api)\n  - [`rehypeMdxCodeProps`](#rehypemdxcodeprops)\n- [Compatibility](#compatibility)\n- [License](#license)\n\n## Installation\n\n```sh\nnpm install rehype-mdx-code-props\n```\n\n## Usage\n\nThis plugin interprets markdown code block metadata as JSX props.\n\nFor example, given a file named `example.mdx` with the following content:\n\n````markdown\n```js copy filename=\"awesome.js\" onOpen={props.openDemo} {...props}\nconsole.log('Everything is awesome!')\n```\n````\n\nThe following script:\n\n```js\nimport { readFile } from 'node:fs/promises'\n\nimport { compile } from '@mdx-js/mdx'\nimport rehypeMdxCodeProps from 'rehype-mdx-code-props'\n\nconst { value } = await compile(await readFile('example.mdx'), {\n  jsx: true,\n  rehypePlugins: [rehypeMdxCodeProps]\n})\nconsole.log(value)\n```\n\nRoughly yields:\n\n```jsx\nexport default function MDXContent(props) {\n  return (\n    <pre copy filename=\"awesome.js\" onOpen={props.openDemo} {...props}>\n      <code className=\"language-js\">{\"console.log('Everything is awesome!');\\n\"}</code>\n    </pre>\n  )\n}\n```\n\nThe `<pre />` element doesn’t support those custom props. Use custom\n[components](https://mdxjs.com/docs/using-mdx/#components) to give the props meaning.\n\n> **Note** This plugin transforms the [`hast`](https://github.com/syntax-tree/hast) (HTML) nodes\n> into JSX. After running this plugin, they can no longer be processed by other plugins. To combine\n> it with other plugins, such as syntax highlighting plugins, `rehype-mdx-code-props` must run last.\n\n## API\n\nThis package has a default export `rehypeMdxCodeProps`.\n\n### `rehypeMdxCodeProps`\n\nAn MDX rehype plugin for transforming markdown code meta into JSX props.\n\n#### Options\n\n- `elementAttributeNameCase` (`'html' | 'react'`): The casing to use for attribute names. This\n  should match the `elementAttributeNameCase` value passed to MDX. (Default: `'react'`)\n- `tagName` (`'code' | 'pre'`): The tag name to add the attributes to. (Default: `'pre'`)\n\n## Compatibility\n\nThis plugin works with Node.js 16 or greater and MDX 3.\n\n## License\n\n[MIT](LICENSE.md) © [Remco Haszing](https://github.com/remcohaszing)\n","readmeFilename":"README.md"}