{"id":33247477,"url":"https://github.com/syntax-tree/mdast-util-mdx-jsx","last_synced_at":"2025-11-16T21:03:05.979Z","repository":{"id":44541598,"uuid":"319096246","full_name":"syntax-tree/mdast-util-mdx-jsx","owner":"syntax-tree","description":"mdast extension to parse and serialize MDX JSX","archived":false,"fork":false,"pushed_at":"2025-01-13T10:46:30.000Z","size":251,"stargazers_count":28,"open_issues_count":0,"forks_count":6,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-11-09T04:36:18.662Z","etag":null,"topics":["jsx","mdast","mdast-util","mdx","mdxjs"],"latest_commit_sha":null,"homepage":"https://unifiedjs.com","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/syntax-tree.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"unifiedjs","open_collective":"unified"}},"created_at":"2020-12-06T17:55:55.000Z","updated_at":"2025-10-18T09:34:28.000Z","dependencies_parsed_at":"2024-06-18T15:26:46.862Z","dependency_job_id":"aea8177d-1ea7-46e2-b090-939fd9b0a3be","html_url":"https://github.com/syntax-tree/mdast-util-mdx-jsx","commit_stats":{"total_commits":83,"total_committers":3,"mean_commits":"27.666666666666668","dds":0.02409638554216864,"last_synced_commit":"267fe36ee129fc571b9eb80a5e8bb0163e3ebbe7"},"previous_names":[],"tags_count":25,"template":false,"template_full_name":null,"purl":"pkg:github/syntax-tree/mdast-util-mdx-jsx","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/syntax-tree%2Fmdast-util-mdx-jsx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/syntax-tree%2Fmdast-util-mdx-jsx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/syntax-tree%2Fmdast-util-mdx-jsx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/syntax-tree%2Fmdast-util-mdx-jsx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/syntax-tree","download_url":"https://codeload.github.com/syntax-tree/mdast-util-mdx-jsx/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/syntax-tree%2Fmdast-util-mdx-jsx/sbom","scorecard":{"id":863493,"data":{"date":"2025-08-11","repo":{"name":"github.com/syntax-tree/mdast-util-mdx-jsx","commit":"0f3033ce1ce34e3c56bd81fc65e24a1dadb854c3"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":4.2,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Code-Review","score":1,"reason":"Found 3/30 approved changesets -- score normalized to 1","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: third-party GitHubAction not pinned by hash: .github/workflows/bb.yml:5: update your workflow using https://app.stepsecurity.io/secureworkflow/syntax-tree/mdast-util-mdx-jsx/bb.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/main.yml:6: update your workflow using https://app.stepsecurity.io/secureworkflow/syntax-tree/mdast-util-mdx-jsx/main.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/main.yml:7: update your workflow using https://app.stepsecurity.io/secureworkflow/syntax-tree/mdast-util-mdx-jsx/main.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/main.yml:12: update your workflow using https://app.stepsecurity.io/secureworkflow/syntax-tree/mdast-util-mdx-jsx/main.yml/main?enable=pin","Warn: npmCommand not pinned by hash: .github/workflows/main.yml:11","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   2 third-party GitHubAction dependencies pinned","Info:   0 out of   1 npmCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/bb.yml:1","Warn: no topLevel permission defined: .github/workflows/main.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: license:0","Info: FSF or OSI recognized license: MIT License: license:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'main'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Security-Policy","score":10,"reason":"security policy file detected","details":["Info: security policy file detected: github.com/syntax-tree/.github/security.md:1","Info: Found linked content: github.com/syntax-tree/.github/security.md:1","Info: Found disclosure, vulnerability, and/or timelines in security policy: github.com/syntax-tree/.github/security.md:1","Info: Found text in security policy: github.com/syntax-tree/.github/security.md:1"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 3 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-24T02:00:56.165Z","repository_id":44541598,"created_at":"2025-08-24T02:00:56.165Z","updated_at":"2025-08-24T02:00:56.165Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":284380472,"owners_count":26995032,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-11-14T02:00:06.101Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["jsx","mdast","mdast-util","mdx","mdxjs"],"created_at":"2025-11-16T21:01:18.453Z","updated_at":"2025-11-16T21:03:01.037Z","avatar_url":"https://github.com/syntax-tree.png","language":"JavaScript","funding_links":["https://github.com/sponsors/unifiedjs","https://opencollective.com/unified"],"categories":[],"sub_categories":[],"readme":"# mdast-util-mdx-jsx\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[mdast][] extensions to parse and serialize [MDX][] JSX (`\u003ca /\u003e`).\n\n## Contents\n\n* [What is this?](#what-is-this)\n* [When to use this](#when-to-use-this)\n* [Install](#install)\n* [Use](#use)\n* [API](#api)\n  * [`mdxJsxFromMarkdown()`](#mdxjsxfrommarkdown)\n  * [`mdxJsxToMarkdown(options?)`](#mdxjsxtomarkdownoptions)\n  * [`MdxJsxAttribute`](#mdxjsxattribute)\n  * [`MdxJsxAttributeValueExpression`](#mdxjsxattributevalueexpression)\n  * [`MdxJsxExpressionAttribute`](#mdxjsxexpressionattribute)\n  * [`MdxJsxFlowElement`](#mdxjsxflowelement)\n  * [`MdxJsxFlowElementHast`](#mdxjsxflowelementhast)\n  * [`MdxJsxTextElement`](#mdxjsxtextelement)\n  * [`MdxJsxTextElementHast`](#mdxjsxtextelementhast)\n  * [`ToMarkdownOptions`](#tomarkdownoptions)\n* [HTML](#html)\n* [Syntax](#syntax)\n* [Syntax tree](#syntax-tree)\n  * [Nodes](#nodes)\n  * [Mixin](#mixin)\n  * [Content model](#content-model)\n* [Types](#types)\n* [Compatibility](#compatibility)\n* [Related](#related)\n* [Contribute](#contribute)\n* [License](#license)\n\n## What is this?\n\nThis package contains two extensions that add support for MDX JSX syntax in\nmarkdown to [mdast][].\nThese extensions plug into\n[`mdast-util-from-markdown`][mdast-util-from-markdown] (to support parsing\nJSX in markdown into a syntax tree) and\n[`mdast-util-to-markdown`][mdast-util-to-markdown] (to support serializing\nJSX in syntax trees to markdown).\n\n[JSX][] is an XML-like syntax extension to ECMAScript (JavaScript), which MDX\nbrings to markdown.\nFor more info on MDX, see [What is MDX?][what-is-mdx]\n\n## When to use this\n\nYou can use these extensions when you are working with\n`mdast-util-from-markdown` and `mdast-util-to-markdown` already.\n\nWhen working with `mdast-util-from-markdown`, you must combine this package\nwith [`micromark-extension-mdx-jsx`][micromark-extension-mdx-jsx].\n\nWhen you are working with syntax trees and want all of MDX, use\n[`mdast-util-mdx`][mdast-util-mdx] instead.\n\nAll these packages are used in [`remark-mdx`][remark-mdx], which\nfocusses on making it easier to transform content by abstracting these\ninternals away.\n\n## Install\n\nThis package is [ESM only][esm].\nIn Node.js (version 16+), install with [npm][]:\n\n```sh\nnpm install mdast-util-mdx-jsx\n```\n\nIn Deno with [`esm.sh`][esmsh]:\n\n```js\nimport {mdxJsxFromMarkdown, mdxJsxToMarkdown} from 'https://esm.sh/mdast-util-mdx-jsx@3'\n```\n\nIn browsers with [`esm.sh`][esmsh]:\n\n```html\n\u003cscript type=\"module\"\u003e\n  import {mdxJsxFromMarkdown, mdxJsxToMarkdown} from 'https://esm.sh/mdast-util-mdx-jsx@3?bundle'\n\u003c/script\u003e\n```\n\n## Use\n\nSay our document `example.mdx` contains:\n\n```mdx\n\u003cBox\u003e\n  - a list\n\u003c/Box\u003e\n\n\u003cMyComponent {...props} /\u003e\n\n\u003cabbr title=\"Hypertext Markup Language\"\u003eHTML\u003c/abbr\u003e is a lovely language.\n```\n\n…and our module `example.js` looks as follows:\n\n```js\nimport fs from 'node:fs/promises'\nimport * as acorn from 'acorn'\nimport {mdxJsx} from 'micromark-extension-mdx-jsx'\nimport {fromMarkdown} from 'mdast-util-from-markdown'\nimport {mdxJsxFromMarkdown, mdxJsxToMarkdown} from 'mdast-util-mdx-jsx'\nimport {toMarkdown} from 'mdast-util-to-markdown'\n\nconst doc = await fs.readFile('example.mdx')\n\nconst tree = fromMarkdown(doc, {\n  extensions: [mdxJsx({acorn, addResult: true})],\n  mdastExtensions: [mdxJsxFromMarkdown()]\n})\n\nconsole.log(tree)\n\nconst out = toMarkdown(tree, {extensions: [mdxJsxToMarkdown()]})\n\nconsole.log(out)\n```\n\n…now running `node example.js` yields (positional info removed for brevity):\n\n```js\n{\n  type: 'root',\n  children: [\n    {\n      type: 'mdxJsxFlowElement',\n      name: 'Box',\n      attributes: [],\n      children: [\n        {\n          type: 'list',\n          ordered: false,\n          start: null,\n          spread: false,\n          children: [\n            {\n              type: 'listItem',\n              spread: false,\n              checked: null,\n              children: [\n                {type: 'paragraph', children: [{type: 'text', value: 'a list'}]}\n              ]\n            }\n          ]\n        }\n      ]\n    },\n    {\n      type: 'mdxJsxFlowElement',\n      name: 'MyComponent',\n      attributes: [\n        {\n          type: 'mdxJsxExpressionAttribute',\n          value: '...props',\n          data: {\n            estree: {\n              type: 'Program',\n              body: [\n                {\n                  type: 'ExpressionStatement',\n                  expression: {\n                    type: 'ObjectExpression',\n                    properties: [\n                      {\n                        type: 'SpreadElement',\n                        argument: {type: 'Identifier', name: 'props'}\n                      }\n                    ]\n                  }\n                }\n              ],\n              sourceType: 'module'\n            }\n          }\n        }\n      ],\n      children: []\n    },\n    {\n      type: 'paragraph',\n      children: [\n        {\n          type: 'mdxJsxTextElement',\n          name: 'abbr',\n          attributes: [\n            {\n              type: 'mdxJsxAttribute',\n              name: 'title',\n              value: 'Hypertext Markup Language'\n            }\n          ],\n          children: [{type: 'text', value: 'HTML'}]\n        },\n        {type: 'text', value: ' is a lovely language.'}\n      ]\n    }\n  ]\n}\n```\n\n```markdown\n\u003cBox\u003e\n  *   a list\n\u003c/Box\u003e\n\n\u003cMyComponent {...props} /\u003e\n\n\u003cabbr title=\"Hypertext Markup Language\"\u003eHTML\u003c/abbr\u003e is a lovely language.\n```\n\n## API\n\nThis package exports the identifiers\n[`mdxJsxFromMarkdown`][api-mdx-jsx-from-markdown] and\n[`mdxJsxToMarkdown`][api-mdx-jsx-to-markdown].\nThere is no default export.\n\n### `mdxJsxFromMarkdown()`\n\nCreate an extension for\n[`mdast-util-from-markdown`][mdast-util-from-markdown]\nto enable MDX JSX.\n\n###### Returns\n\nExtension for `mdast-util-from-markdown` to enable MDX JSX\n([`FromMarkdownExtension`][from-markdown-extension]).\n\nWhen using the [micromark syntax extension][micromark-extension-mdx-jsx] with\n`addResult`, nodes will have a `data.estree` field set to an ESTree\n[`Program`][program] node.\n\n### `mdxJsxToMarkdown(options?)`\n\nCreate an extension for\n[`mdast-util-to-markdown`][mdast-util-to-markdown]\nto enable MDX JSX.\n\nThis extension configures `mdast-util-to-markdown` with\n[`options.fences: true`][mdast-util-to-markdown-fences] and\n[`options.resourceLink: true`][mdast-util-to-markdown-resourcelink] too, do not\noverwrite them!\n\n###### Parameters\n\n* `options` ([`ToMarkdownOptions`][api-to-markdown-options])\n  — configuration\n\n###### Returns\n\nExtension for `mdast-util-to-markdown` to enable MDX JSX\n([`FromMarkdownExtension`][to-markdown-extension]).\n\n### `MdxJsxAttribute`\n\nMDX JSX attribute with a key (TypeScript type).\n\n###### Type\n\n```ts\nimport type {Literal} from 'mdast'\n\ninterface MdxJsxAttribute extends Literal {\n  type: 'mdxJsxAttribute'\n  name: string\n  value?: MdxJsxAttributeValueExpression | string | null | undefined\n}\n```\n\n### `MdxJsxAttributeValueExpression`\n\nMDX JSX attribute value set to an expression (TypeScript type).\n\n###### Type\n\n```ts\nimport type {Program} from 'estree-jsx'\nimport type {Literal} from 'mdast'\n\ninterface MdxJsxAttributeValueExpression extends Literal {\n  type: 'mdxJsxAttributeValueExpression'\n  data?: {estree?: Program | null | undefined} \u0026 Literal['data']\n}\n```\n\n### `MdxJsxExpressionAttribute`\n\nMDX JSX attribute as an expression (TypeScript type).\n\n###### Type\n\n```ts\nimport type {Program} from 'estree-jsx'\nimport type {Literal} from 'mdast'\n\ninterface MdxJsxExpressionAttribute extends Literal {\n  type: 'mdxJsxExpressionAttribute'\n  data?: {estree?: Program | null | undefined} \u0026 Literal['data']\n}\n```\n\n### `MdxJsxFlowElement`\n\nMDX JSX element node, occurring in flow (block) (TypeScript type).\n\n###### Type\n\n```ts\nimport type {BlockContent, DefinitionContent, Parent} from 'mdast'\n\nexport interface MdxJsxFlowElement extends Parent {\n  type: 'mdxJsxFlowElement'\n  name: string | null\n  attributes: Array\u003cMdxJsxAttribute | MdxJsxExpressionAttribute\u003e\n  children: Array\u003cBlockContent | DefinitionContent\u003e\n}\n```\n\n### `MdxJsxFlowElementHast`\n\nSame as [`MdxJsxFlowElement`][api-mdx-jsx-flow-element], but registered with\n`@types/hast` (TypeScript type).\n\n###### Type\n\n```ts\nimport type {ElementContent, Parent} from 'hast'\n\nexport interface MdxJsxFlowElementHast extends Parent {\n  type: 'mdxJsxFlowElement'\n  name: string | null\n  attributes: Array\u003cMdxJsxAttribute | MdxJsxExpressionAttribute\u003e\n  children: Array\u003cElementContent\u003e\n}\n```\n\n### `MdxJsxTextElement`\n\nMDX JSX element node, occurring in text (phrasing) (TypeScript type).\n\n###### Type\n\n```ts\nimport type {Parent, PhrasingContent} from 'mdast'\n\nexport interface MdxJsxTextElement extends Parent {\n  type: 'mdxJsxTextElement'\n  name: string | null\n  attributes: Array\u003cMdxJsxAttribute | MdxJsxExpressionAttribute\u003e\n  children: Array\u003cPhrasingContent\u003e\n}\n```\n\n### `MdxJsxTextElementHast`\n\nSame as [`MdxJsxTextElement`][api-mdx-jsx-text-element], but registered with\n`@types/hast` (TypeScript type).\n\n###### Type\n\n```ts\nimport type {ElementContent, Parent} from 'hast'\n\nexport interface MdxJsxTextElementHast extends Parent {\n  type: 'mdxJsxTextElement'\n  name: string | null\n  attributes: Array\u003cMdxJsxAttribute | MdxJsxExpressionAttribute\u003e\n  children: Array\u003cElementContent\u003e\n}\n```\n\n### `ToMarkdownOptions`\n\nConfiguration (TypeScript type).\n\n##### Fields\n\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: `\u003cimg/\u003e`\n  instead of `\u003cimg /\u003e`\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\n## HTML\n\nMDX JSX has no representation in HTML.\nThough, when you are dealing with MDX, you will likely go *through* hast.\nYou can enable passing MDX JSX through to hast by configuring\n[`mdast-util-to-hast`][mdast-util-to-hast] with\n`passThrough: ['mdxJsxFlowElement', 'mdxJsxTextElement']`.\n\n## Syntax\n\nSee [Syntax in `micromark-extension-mdx-jsx`][syntax].\n\n## Syntax tree\n\nThe following interfaces are added to **[mdast][]** by this utility.\n\n### Nodes\n\n#### `MdxJsxFlowElement`\n\n```idl\ninterface MdxJsxFlowElement \u003c: Parent {\n  type: 'mdxJsxFlowElement'\n}\n\nMdxJsxFlowElement includes MdxJsxElement\n```\n\n**MdxJsxFlowElement** (**[Parent][dfn-parent]**) represents JSX in flow (block).\nIt can be used where **[flow][dfn-content-flow]** content is expected.\nIt includes the mixin **[MdxJsxElement][dfn-mixin-mdx-jsx-element]**.\n\nFor example, the following markdown:\n\n```markdown\n\u003cw x=\"y\"\u003e\n  z\n\u003c/w\u003e\n```\n\nYields:\n\n```js\n{\n  type: 'mdxJsxFlowElement',\n  name: 'w',\n  attributes: [{type: 'mdxJsxAttribute', name: 'x', value: 'y'}],\n  children: [{type: 'paragraph', children: [{type: 'text', value: 'z'}]}]\n}\n```\n\n#### `MdxJsxTextElement`\n\n```idl\ninterface MdxJsxTextElement \u003c: Parent {\n  type: 'mdxJsxTextElement'\n}\n\nMdxJsxTextElement includes MdxJsxElement\n```\n\n**MdxJsxTextElement** (**[Parent][dfn-parent]**) represents JSX in text (span,\ninline).\nIt can be used where **[phrasing][dfn-content-phrasing]** content is\nexpected.\nIt includes the mixin **[MdxJsxElement][dfn-mixin-mdx-jsx-element]**.\n\nFor example, the following markdown:\n\n```markdown\na \u003cb c\u003ed\u003c/b\u003e e.\n```\n\nYields:\n\n```js\n{\n  type: 'mdxJsxTextElement',\n  name: 'b',\n  attributes: [{type: 'mdxJsxAttribute', name: 'c', value: null}],\n  children: [{type: 'text', value: 'd'}]\n}\n```\n\n### Mixin\n\n#### `MdxJsxElement`\n\n```idl\ninterface mixin MdxJsxElement {\n  name: string?\n  attributes: [MdxJsxExpressionAttribute | MdxJsxAttribute]\n}\n\ninterface MdxJsxExpressionAttribute \u003c: Literal {\n  type: 'mdxJsxExpressionAttribute'\n}\n\ninterface MdxJsxAttribute \u003c: Node {\n  type: 'mdxJsxAttribute'\n  name: string\n  value: MdxJsxAttributeValueExpression | string?\n}\n\ninterface MdxJsxAttributeValueExpression \u003c: Literal {\n  type: 'mdxJsxAttributeValueExpression'\n}\n```\n\n**MdxJsxElement** represents a JSX element.\n\nThe `name` field can be present and represents an identifier.\nWithout `name`, the element represents a fragment, in which case no attributes\nmust be present.\n\nThe `attributes` field represents information associated with the node.\nThe value of the `attributes` field is a list of **MdxJsxExpressionAttribute**\nand **MdxJsxAttribute** nodes.\n\n**MdxJsxExpressionAttribute** represents an expression (typically in a\nprogramming language) that when evaluated results in multiple attributes.\n\n**MdxJsxAttribute** represents a single attribute.\nThe `name` field must be present.\nThe `value` field can be present, in which case it is either a string (a static\nvalue) or an expression (typically in a programming language) that when\nevaluated results in an attribute value.\n\n### Content model\n\n###### `FlowContent` (MDX JSX)\n\n```idl\ntype MdxJsxFlowContent = MdxJsxFlowElement | FlowContent\n```\n\n###### `PhrasingContent` (MDX JSX)\n\n```idl\ntype MdxJsxPhrasingContent = MdxJsxTextElement | PhrasingContent\n```\n\n## Types\n\nThis package is fully typed with [TypeScript][].\nIt exports the additional types  [`MdxJsxAttribute`][api-mdx-jsx-attribute],\n[`MdxJsxAttributeValueExpression`][api-mdx-jsx-attribute-value-expression],\n[`MdxJsxExpressionAttribute`][api-mdx-jsx-expression-attribute],\n[`MdxJsxFlowElement`][api-mdx-jsx-flow-element],\n[`MdxJsxFlowElementHast`][api-mdx-jsx-flow-element-hast],\n[`MdxJsxTextElement`][api-mdx-jsx-text-element],\n[`MdxJsxTextElementHast`][api-mdx-jsx-text-element-hast], and\n[`ToMarkdownOptions`][api-to-markdown-options].\n\nIt also registers the node types with `@types/mdast` and `@types/hast`.\nIf you’re working with the syntax tree, make sure to import this utility\nsomewhere in your types, as that registers the new node types in the tree.\n\n```js\n/**\n * @import {} from 'mdast-util-mdx-jsx'\n * @import {Root} from 'mdast'\n */\n\nimport {visit} from 'unist-util-visit'\n\n/** @type {Root} */\nconst tree = getMdastNodeSomeHow()\n\nvisit(tree, function (node) {\n  // `node` can now be one of the JSX nodes.\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, `mdast-util-mdx-jsx@3`,\ncompatible with Node.js 16.\n\nThis utility works with `mdast-util-from-markdown` version 2+ and\n`mdast-util-to-markdown` version 2+.\n\n## Related\n\n* [`micromark/micromark-extension-mdx-jsx`][micromark-extension-mdx-jsx]\n  — support MDX JSX in micromark\n* [`syntax-tree/mdast-util-mdx`][mdast-util-mdx]\n  — support MDX in mdast\n* [`remarkjs/remark-mdx`][remark-mdx]\n  — support MDX in remark\n\n## Contribute\n\nSee [`contributing.md`][contributing] in [`syntax-tree/.github`][health] for\nways to 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[build-badge]: https://github.com/syntax-tree/mdast-util-mdx-jsx/workflows/main/badge.svg\n\n[build]: https://github.com/syntax-tree/mdast-util-mdx-jsx/actions\n\n[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/mdast-util-mdx-jsx.svg\n\n[coverage]: https://codecov.io/github/syntax-tree/mdast-util-mdx-jsx\n\n[downloads-badge]: https://img.shields.io/npm/dm/mdast-util-mdx-jsx.svg\n\n[downloads]: https://www.npmjs.com/package/mdast-util-mdx-jsx\n\n[size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size\u0026query=$.size.compressedSize\u0026url=https://deno.bundlejs.com/?q=mdast-util-mdx-jsx\n\n[size]: https://bundlejs.com/?q=mdast-util-mdx-jsx\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/syntax-tree/unist/discussions\n\n[npm]: https://docs.npmjs.com/cli/install\n\n[esmsh]: https://esm.sh\n\n[license]: license\n\n[author]: https://wooorm.com\n\n[health]: https://github.com/syntax-tree/.github\n\n[contributing]: https://github.com/syntax-tree/.github/blob/main/contributing.md\n\n[support]: https://github.com/syntax-tree/.github/blob/main/support.md\n\n[coc]: https://github.com/syntax-tree/.github/blob/main/code-of-conduct.md\n\n[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c\n\n[typescript]: https://www.typescriptlang.org\n\n[mdast]: https://github.com/syntax-tree/mdast\n\n[mdast-util-to-hast]: https://github.com/syntax-tree/mdast-util-to-hast\n\n[mdast-util-from-markdown]: https://github.com/syntax-tree/mdast-util-from-markdown\n\n[from-markdown-extension]: https://github.com/syntax-tree/mdast-util-from-markdown#extension\n\n[mdast-util-to-markdown]: https://github.com/syntax-tree/mdast-util-to-markdown\n\n[to-markdown-extension]: https://github.com/syntax-tree/mdast-util-to-markdown#options\n\n[mdast-util-mdx]: https://github.com/syntax-tree/mdast-util-mdx\n\n[program]: https://github.com/estree/estree/blob/master/es2015.md#programs\n\n[dfn-parent]: https://github.com/syntax-tree/mdast#parent\n\n[dfn-content-flow]: #flowcontent-mdx-jsx\n\n[dfn-content-phrasing]: #phrasingcontent-mdx-jsx\n\n[dfn-mixin-mdx-jsx-element]: #mdxjsxelement\n\n[jsx]: https://facebook.github.io/jsx/\n\n[what-is-mdx]: https://mdxjs.com/docs/what-is-mdx/\n\n[micromark-extension-mdx-jsx]: https://github.com/micromark/micromark-extension-mdx-jsx\n\n[syntax]: https://github.com/micromark/micromark-extension-mdx-jsx#syntax\n\n[mdast-util-to-markdown-fences]: https://github.com/syntax-tree/mdast-util-to-markdown#optionsfences\n\n[mdast-util-to-markdown-resourcelink]: https://github.com/syntax-tree/mdast-util-to-markdown#optionsresourcelink\n\n[remark-mdx]: https://mdxjs.com/packages/remark-mdx/\n\n[mdx]: https://mdxjs.com\n\n[api-mdx-jsx-from-markdown]: #mdxjsxfrommarkdown\n\n[api-mdx-jsx-to-markdown]: #mdxjsxtomarkdownoptions\n\n[api-mdx-jsx-attribute]: #mdxjsxattribute\n\n[api-mdx-jsx-attribute-value-expression]: #mdxjsxattributevalueexpression\n\n[api-mdx-jsx-expression-attribute]: #mdxjsxexpressionattribute\n\n[api-mdx-jsx-flow-element]: #mdxjsxflowelement\n\n[api-mdx-jsx-flow-element-hast]: #mdxjsxflowelementhast\n\n[api-mdx-jsx-text-element]: #mdxjsxtextelement\n\n[api-mdx-jsx-text-element-hast]: #mdxjsxtextelementhast\n\n[api-to-markdown-options]: #tomarkdownoptions\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsyntax-tree%2Fmdast-util-mdx-jsx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsyntax-tree%2Fmdast-util-mdx-jsx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsyntax-tree%2Fmdast-util-mdx-jsx/lists"}