A recma plugin to define the isMDXComponent property on MDX components.
npm install recma-mdx-is-mdx-component



A recma plugin to define the isMDXComponent property on MDX components.
- Installation
- Usage
- API
- Compatibility
- License
``sh`
npm install recma-mdx-is-mdx-component
This recma plugin assigns true to the property MDXContent.isMDXComponent.
For example, given a file named example.mdx with the following contents:
`mdx`
Some MDX content
The following script:
`js
import { readFile } from 'node:fs/promises'
import { compile } from '@mdx-js/mdx'
import recmaPluginInjectisMDXComponent from 'recma-mdx-is-mdx-component'
const { contents } = await compile(await readFile('example.mdx'), {
jsx: true,
recmaPlugins: [recmaPluginInjectisMDXComponent]
})
console.log(contents)
`
Roughly yields:
` Some MDX contentjsx``
MDXContent.isMDXComponent = true
export default function MDXContent() {
return
}
The default export is a recma plugin. It takes no options.
This project is compatible with Node.js 20 or greater.