{"name":"remark-mdx","version":"3.1.1","description":"remark plugin to support MDX syntax","license":"MIT","keywords":["javascript","jsx","markdown","mdast","mdx","plugin","remark","remark-plugin","unified","xml"],"homepage":"https://mdxjs.com","repository":{"type":"git","url":"git+https://github.com/mdx-js/mdx.git","directory":"packages/remark-mdx/"},"bugs":{"url":"https://github.com/mdx-js/mdx/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"},{"name":"Christian Murphy","email":"christian.murphy.42@gmail.com"}],"type":"module","sideEffects":false,"exports":"./index.js","dependencies":{"mdast-util-mdx":"^3.0.0","micromark-extension-mdxjs":"^3.0.0"},"devDependencies":{},"scripts":{"test":"npm run test-coverage","test-api":"node --conditions development test/index.js","test-coverage":"c8 --100 --reporter lcov npm run test-api"},"xo":{"prettier":true,"rules":{"logical-assignment-operators":"off","n/file-extension-in-import":"off","unicorn/no-this-assignment":"off"}},"_id":"remark-mdx@3.1.1","gitHead":"50aa8df0b027c893dec9f97a2b7c51539e9f1a4b","types":"./index.d.ts","_nodeVersion":"23.9.0","_npmVersion":"11.5.2","dist":{"integrity":"sha512-Pjj2IYlUY3+D8x00UJsIOg5BEvfMyeI+2uLPn9VO9Wg4MEtN/VTIq2NEJQfde9PnX15KgtHyl9S0BcTnWrIuWg==","shasum":"047f97038bc7ec387aebb4b0a4fe23779999d845","tarball":"http://registry-npm.ywwl.com/remark-mdx/download/remark-mdx-3.1.1.tgz","fileCount":9,"unpackedSize":14741,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCID0HKmb1G6ZbXRGYD7n7NRbE0aJvhdI8cJel2NxwL1zAAiAl1EqOIIqEaYOgTQDte7C6fqXBXmtPNZ+2N4V6olQmBA=="}],"size":5609,"noattachment":false,"key":"/remark-mdx/-/remark-mdx-3.1.1.tgz"},"_npmUser":{"name":"wooorm","email":"tituswormer@gmail.com"},"directories":{},"maintainers":[{"name":"johno","email":"johnotander@gmail.com"},{"name":"timneutkens","email":"timneutkens@icloud.com"},{"name":"wooorm","email":"tituswormer@gmail.com"},{"name":"remcohaszing","email":"remcohaszing@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/remark-mdx_3.1.1_1756490572157_0.6114381289027135"},"_hasShrinkwrap":false,"readme":"# remark-mdx\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\nremark plugin to support the MDX syntax (JSX, export/import, expressions).\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  * [`unified().use(remarkMdx[, options])`](#unifieduseremarkmdx-options)\n  * [`Options`](#options)\n* [Authoring](#authoring)\n* [HTML](#html)\n* [Syntax](#syntax)\n* [Syntax tree](#syntax-tree)\n* [Errors](#errors)\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 [unified][] ([remark][]) plugin to enable the extensions to\nmarkdown that MDX adds: JSX (`<x/>`), export/import (`export x from 'y'`), and\nexpression {`{1 + 1}`}.\nYou can use this plugin to add support for parsing and serializing them.\n\nThis plugin does not handle how MDX is compiled to JavaScript or evaluated and\nrendered to HTML.\nThat’s done by [`@mdx-js/mdx`][mdx].\n\n## When should I use this?\n\nThis plugin is useful if you’re dealing with the MDX syntax and integrating\nwith remark, rehype, and the rest of unified.\nSome example use cases are when you want to lint the syntax or compile it to\nsomething other that JavaScript.\n\nIf you don’t use plugins and want to access the syntax tree, you can use\n[`mdast-util-from-markdown`][mdast-util-from-markdown] with\n[`mdast-util-mdx`][mdast-util-mdx].\n\nTypically though, you’d want to move a layer up: `@mdx-js/mdx`.\nThat package is the core compiler for turning MDX into JavaScript which\ngives you the most control.\nOr even higher: if you’re using a bundler (Rollup, esbuild, webpack), or a site\nbuilder (Next.js) or build system (Vite) which comes with a bundler, you’re\nbetter off using an integration: see [§ Integrations][integrations].\n\n## Install\n\nThis package is [ESM only][esm].\nIn Node.js (version 16+), install with [npm][]:\n\n```sh\nnpm install remark-mdx\n```\n\nIn Deno with [`esm.sh`][esmsh]:\n\n```tsx\nimport remarkMdx from 'https://esm.sh/remark-mdx@3'\n```\n\nIn browsers with [`esm.sh`][esmsh]:\n\n```html\n<script type=\"module\">\n  import remarkMdx from 'https://esm.sh/remark-mdx@3?bundle'\n</script>\n```\n\n## Use\n\n```tsx\nimport {remark} from 'remark'\nimport remarkMdx from 'remark-mdx'\n\nconst file = await remark()\n  .use(remarkMdx)\n  .process('import a from \"b\"\\n\\na <b /> c {1 + 1} d')\n\nconsole.log(String(file))\n```\n\nYields:\n\n```mdx\nimport a from \"b\"\n\na <b/> c {1 + 1} d\n```\n\n## API\n\nThis package exports no identifiers.\nThe default export is [`remarkMdx`][api-remark-mdx].\n\n### `unified().use(remarkMdx[, options])`\n\nAdd support for MDX (JSX: `<Video id={123} />`, export/imports: `export {x}\nfrom 'y'`; and expressions: `{1 + 1}`).\n\n###### Parameters\n\n* `options` ([`Options`][api-options], optional)\n  — configuration\n\n###### Returns\n\nNothing (`undefined`).\n\n### `Options`\n\nConfiguration (TypeScript type).\n\n###### Fields\n\n* `acornOptions` ([`AcornOptions`][acorn-options], default:\n  `{ecmaVersion: 2024, locations: true, sourceType: 'module'}`)\n  — configuration for acorn; all fields except `locations` can be set\n* `printWidth` (`number`, default: `Infinity`)\n  — try and wrap syntax at this width;\n  when set to a finite number (say, `80`), the formatter will print\n  attributes on separate lines when a tag doesn’t fit on one line;\n  the normal behavior is to print attributes with spaces between them instead\n  of line endings\n* `quote` (`'\"'` or `\"'\"`, default: `'\"'`)\n  — preferred quote to use around attribute values\n* `quoteSmart` (`boolean`, default: `false`)\n  — use the other quote if that results in less bytes\n* `tightSelfClosing` (`boolean`, default: `false`)\n  — do not use an extra space when closing self-closing elements: `<img/>`\n  instead of `<img />`\n\n<!-- Note: `acorn`, `addResult`, `allowEmpty`, and `spread` are intentionally not documented. -->\n\n## Authoring\n\nFor recommendations on how to author MDX, see each corresponding readme:\n\n* [ESM](https://github.com/micromark/micromark-extension-mdxjs-esm#authoring)\n* [JSX](https://github.com/micromark/micromark-extension-mdx-jsx#authoring)\n* [expressions](https://github.com/micromark/micromark-extension-mdx-expression/tree/main/packages/micromark-extension-mdx-expression#authoring)\n* [CommonMark features not in MDX](https://github.com/micromark/micromark-extension-mdx-md#authoring)\n\n## HTML\n\nMDX has no representation in HTML.\nThough, when you are dealing with MDX, you will likely go *through* hast.\nYou can enable passing MDX through to hast by configuring\n[`remark-rehype`][remark-rehype] with `passThrough: ['mdxjsEsm',\n'mdxFlowExpression', 'mdxJsxFlowElement', 'mdxJsxTextElement', 'mdxTextExpression']`.\n\n## Syntax\n\nFor info on the syntax of these features, see each corresponding readme:\n\n* [ESM](https://github.com/micromark/micromark-extension-mdxjs-esm#syntax)\n* [JSX](https://github.com/micromark/micromark-extension-mdx-jsx#syntax)\n* [expressions](https://github.com/micromark/micromark-extension-mdx-expression/tree/main/packages/micromark-extension-mdx-expression#syntax)\n* CommonMark features not in MDX: n/a\n\n## Syntax tree\n\nFor info on the syntax tree of these features, see each corresponding readme:\n\n* [ESM](https://github.com/syntax-tree/mdast-util-mdxjs-esm#syntax-tree)\n* [JSX](https://github.com/syntax-tree/mdast-util-mdx-jsx#syntax-tree)\n* [expressions](https://github.com/syntax-tree/mdast-util-mdx-expression#syntax-tree)\n* CommonMark features not in MDX: n/a\n\n## Errors\n\nFor info on what errors are thrown, see each corresponding readme:\n\n* [ESM](https://github.com/micromark/micromark-extension-mdxjs-esm#errors)\n* [JSX](https://github.com/micromark/micromark-extension-mdx-jsx#errors)\n* [expressions](https://github.com/micromark/micromark-extension-mdx-expression/tree/main/packages/micromark-extension-mdx-expression#errors)\n* CommonMark features not in MDX: n/a\n\n## Types\n\nThis package is fully typed with [TypeScript][].\nIt exports the additional type [`Options`][api-options].\n\nIf you’re working with the syntax tree, you can register the new node types\nwith `@types/mdast` by adding a reference:\n\n```tsx\n// Register MDX nodes in mdast:\n/// <reference types=\"remark-mdx\" />\n\n/**\n * @import {Root} from 'mdast'\n */\n\nimport {visit} from 'unist-util-visit'\n\nfunction myRemarkPlugin() {\n  /**\n   * @param {Root} tree\n   *   Tree.\n   * @returns {undefined}\n   *   Nothing.\n   */\n  return function (tree) {\n    visit(tree, function (node) {\n      console.log(node) // `node` can now be one of the MDX nodes.\n    })\n  }\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-mdx@^3`, compatible\nwith Node.js 16.\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][] © [Titus Wormer][author]\n\n[acorn-options]: https://github.com/acornjs/acorn/blob/520547b/acorn/src/acorn.d.ts#L578\n\n[api-options]: #options\n\n[api-remark-mdx]: #unifieduseremarkmdx-options\n\n[author]: https://wooorm.com\n\n[backers-badge]: https://opencollective.com/unified/backers/badge.svg\n\n[build]: https://github.com/mdx-js/mdx/actions\n\n[build-badge]: https://github.com/mdx-js/mdx/workflows/main/badge.svg\n\n[chat]: https://github.com/mdx-js/mdx/discussions\n\n[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg\n\n[coc]: https://github.com/mdx-js/.github/blob/main/code-of-conduct.md\n\n[collective]: https://opencollective.com/unified\n\n[contribute]: https://mdxjs.com/community/contribute/\n\n[coverage]: https://codecov.io/github/mdx-js/mdx\n\n[coverage-badge]: https://img.shields.io/codecov/c/github/mdx-js/mdx/main.svg\n\n[downloads]: https://www.npmjs.com/package/remark-mdx\n\n[downloads-badge]: https://img.shields.io/npm/dm/remark-mdx.svg\n\n[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c\n\n[esmsh]: https://esm.sh\n\n[integrations]: https://mdxjs.com/getting-started/#integrations\n\n[mdast-util-from-markdown]: https://github.com/syntax-tree/mdast-util-from-markdown\n\n[mdast-util-mdx]: https://github.com/syntax-tree/mdast-util-mdx\n\n[mdx]: https://mdxjs.com/packages/mdx/\n\n[mit]: https://github.com/mdx-js/mdx/blob/main/packages/remark-mdx/license\n\n[npm]: https://docs.npmjs.com/cli/install\n\n[remark]: https://github.com/remarkjs/remark\n\n[remark-rehype]: https://github.com/remarkjs/remark-rehype\n\n[security]: https://mdxjs.com/getting-started/#security\n\n[size]: https://bundlephobia.com/result?p=remark-mdx\n\n[size-badge]: https://img.shields.io/bundlephobia/minzip/remark-mdx.svg\n\n[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg\n\n[support]: https://mdxjs.com/community/support/\n\n[typescript]: https://www.typescriptlang.org\n\n[unified]: https://github.com/unifiedjs/unified\n","publish_time":1756490572324,"_cnpm_publish_time":1756490572324,"dist-tags":{"ci":"2.0.0-ci.50","latest":"3.1.1","next":"2.0.0-rc.2"}}