{"name":"@mdx-js/react","version":"2.0.0-rc.2","description":"React context for MDX","license":"MIT","keywords":["mdx","markdown","react","jsx","remark","mdxast"],"homepage":"https://mdxjs.com","repository":{"type":"git","url":"git+https://github.com/mdx-js/mdx.git","directory":"packages/react"},"bugs":{"url":"https://github.com/mdx-js/mdx/issues"},"funding":{"type":"opencollective","url":"https://opencollective.com/unified"},"author":{"name":"John Otander","email":"johnotander@gmail.com","url":"https://johno.com"},"contributors":[{"name":"John Otander","email":"johnotander@gmail.com","url":"https://johno.com"},{"name":"Tim Neutkens","email":"tim@vercel.com"},{"name":"Matija Marohnić","email":"matija.marohnic@gmail.com"},{"name":"Titus Wormer","email":"tituswormer@gmail.com","url":"https://wooorm.com"},{"name":"JounQin","email":"admin@1stg.me","url":"https://www.1stg.me"},{"name":"Christian Murphy","email":"christian.murphy.42@gmail.com"}],"type":"module","sideEffects":false,"main":"index.js","types":"index.d.ts","dependencies":{"@types/mdx":"^2.0.0","@types/react":">=16"},"peerDependencies":{"react":">=16"},"devDependencies":{"@mdx-js/mdx":"^2.0.0-rc.2","@types/react":"^17.0.0","@types/react-dom":"^17.0.0","react":"^18.0.0-alpha-327d5c484-20211106","react-dom":"^18.0.0-alpha-327d5c484-20211106"},"scripts":{"prepack":"npm run build","build":"rimraf \"lib/**/*.d.ts\" \"test/**/*.d.ts\" \"index.d.ts\" && tsc && type-coverage","test-api":"node --no-warnings --experimental-loader=../../script/jsx-loader.js ../../node_modules/uvu/bin.js test \"\\.jsx?$\"","test-coverage":"c8 --check-coverage --branches 100 --functions 100 --lines 100 --statements 100 --reporter lcov npm run test-api","test":"npm run build && npm run test-coverage"},"xo":false,"typeCoverage":{"atLeast":100,"detail":true,"strict":true,"ignoreCatch":true},"gitHead":"bf7deab69996449cb99c2217dff75e65855eb2c1","readme":"# `@mdx-js/react`\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\nReact context for MDX.\n\n<!-- more -->\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    *   [`MDXProvider(props?)`](#mdxproviderprops)\n    *   [`useMDXComponents(components?)`](#usemdxcomponentscomponents)\n    *   [`MDXContext`](#mdxcontext)\n    *   [`withMDXComponents(Component)`](#withmdxcomponentscomponent)\n*   [Types](#types)\n*   [Security](#security)\n*   [Contribute](#contribute)\n*   [License](#license)\n\n## What is this?\n\nThis package is a context based components provider for combining React with\nMDX.\n\n## When should I use this?\n\nThis package is not needed for MDX to work with React.\nBut it is nice if you enjoy context-based props passing to avoid repetition.\nThis package adds support for a React context based interface to set components\n(sometimes known as *shortcodes*) by passing them to an `MDXProvider`, which\nthen are used in all nested MDX files implicitly.\nThe alternative is to pass those components to each MDX file.\n\n## Install\n\nThis package is [ESM only][esm]:\nNode 12+ is needed to use it and it must be `import`ed instead of `require`d.\n\n[npm][]:\n\n```sh\nnpm install @mdx-js/react@next\n```\n\n[yarn][]:\n\n```sh\nyarn add @mdx-js/react@next\n```\n\n## Use\n\n```js\nimport {MDXProvider} from '@mdx-js/react'\nimport Post from './post.mdx' // Assumes an integration is used to compile MDX -> JS.\n\nconst components = {\n  em: props => <i {...props} />\n}\n\n<MDXProvider components={components}>\n  <Post />\n</MDXProvider>\n```\n\nNote that you don’t have to use `MDXProvider` and can pass components\ndirectly:\n\n```diff\n-<MDXProvider components={components}>\n-  <Post />\n-</MDXProvider>\n+<Post components={components} />\n```\n\nSee [¶ React in § Getting started][start-react] for how to get started with MDX\nand React.\nSee [¶ MDX provider in § Using MDX][use-provider] for how to use an MDX\nprovider.\n\n## API\n\nThis package exports the following identifiers: `MDXContext`, `MDXProvider`,\n`useMDXComponents`, and `withMDXComponents`.\nThere is no default export.\n\n### `MDXProvider(props?)`\n\nProvider for MDX context.\n\n##### `props`\n\nConfiguration (`Object`, optional).\n\n###### `props.components`\n\nMapping of names for JSX components to React components\n(`Record<string, string|Component|Components>`, optional).\n\n###### `props.disableParentContext`\n\nTurn off outer component context (`boolean`, default: `false`).\n\n###### `props.children`\n\nChildren (JSX elements, optional).\n\n##### Returns\n\nJSX element.\n\n### `useMDXComponents(components?)`\n\nGet current components from the MDX Context.\n\n###### `components`\n\nAdditional components (`Components`) to use or a function that takes the current\ncomponents and filters/merges/changes them (`(currentComponents: Components) =>\nComponents`).\n\n###### Returns\n\n`Components`.\n\n### `MDXContext`\n\n> 🪦 **Deprecated**: This export is not recommended for use as it exposes\n> internals which should be hidden.\n> It might be removed in a future major release.\n> Please use `useMDXComponents` to get context based components and\n> `MDXProvider` to set context based components instead.\n\nThe React Context for MDX (`React.Context`).\n\n### `withMDXComponents(Component)`\n\n> 🪦 **Deprecated**: This export is not recommended for use.\n> It might be removed in a future major release.\n> Please use `useMDXComponents` to get context based components instead.\n\nCreate a HOC of `Components` which is given the current context based MDX\ncomponents.\n\n## Types\n\nThis package is fully typed with [TypeScript][].\n\nAn additional `Components` type is exported, which represents the acceptable\nconfiguration for the functions and components from this project.\n\n## Security\n\nSee [§ Security][security] on our website for information.\n\n## Contribute\n\nSee [§ Contribute][contribute] on our website for ways to get started.\nSee [§ Support][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][] © Compositor and [Vercel][]\n\n[build-badge]: https://github.com/mdx-js/mdx/workflows/main/badge.svg\n\n[build]: https://github.com/mdx-js/mdx/actions\n\n[coverage-badge]: https://img.shields.io/codecov/c/github/mdx-js/mdx/main.svg\n\n[coverage]: https://codecov.io/github/mdx-js/mdx\n\n[downloads-badge]: https://img.shields.io/npm/dm/@mdx-js/react.svg\n\n[downloads]: https://www.npmjs.com/package/@mdx-js/react\n\n[size-badge]: https://img.shields.io/bundlephobia/minzip/@mdx-js/react.svg\n\n[size]: https://bundlephobia.com/result?p=@mdx-js/react\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/mdx-js/mdx/discussions\n\n[npm]: https://docs.npmjs.com/cli/install\n\n[yarn]: https://classic.yarnpkg.com/docs/cli/add/\n\n[contribute]: https://mdxjs.com/community/contribute/\n\n[support]: https://mdxjs.com/community/support/\n\n[coc]: https://github.com/mdx-js/.github/blob/HEAD/code-of-conduct.md\n\n[mit]: https://github.com/mdx-js/mdx/blob/main/packages/react/license\n\n[vercel]: https://vercel.com\n\n[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c\n\n[start-react]: https://mdxjs.com/getting-started/#react\n\n[use-provider]: https://mdxjs.com/using-mdx/#mdx-provider\n\n[security]: https://mdxjs.com/getting-started/#security\n\n[typescript]: https://www.typescriptlang.org\n","readmeFilename":"readme.md","_id":"@mdx-js/react@2.0.0-rc.2","_nodeVersion":"16.9.0","_npmVersion":"7.23.0","dist":{"integrity":"sha512-WHksgPnvKyDDNq0RQvTnKboe+wxUcq5A7xD12Ob+ASfUR3NRFo/h//k8fjv3t8dgzWX5M0UeU5jsccjykosDEQ==","shasum":"83fa80620bc11eec1112d68d77136048a85497df","tarball":"http://registry-npm.ywwl.com/@mdx-js/react/download/@mdx-js/react-2.0.0-rc.2.tgz","fileCount":7,"unpackedSize":13945,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIElu4H/lA+juZFnhxvRLRmTOskRa4wRBXM6EjoiPc5RbAiBbjomz7zogglu9WZ3gXdIkBGpDFqXrSL1jHJdcIHUUlQ=="}],"size":4849,"noattachment":false,"key":"/@mdx-js/react/-/@mdx-js/react-2.0.0-rc.2.tgz"},"_npmUser":{"name":"wooorm","email":"tituswormer@gmail.com"},"directories":{},"maintainers":[{"name":"johno","email":"johnotander@gmail.com"},{"name":"silvenon","email":"matija.marohnic@gmail.com"},{"name":"timneutkens","email":"tim@timneutkens.nl"},{"name":"wooorm","email":"tituswormer@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react_2.0.0-rc.2_1637009501371_0.18136188654578467"},"_hasShrinkwrap":false,"publish_time":1637009501539,"_cnpm_publish_time":1637009501539,"dist-tags":{"ci":"2.0.0-ci.53","latest":"3.1.1","next":"2.0.0-rc.2"}}