A recma plugin to define the isMDXComponent
property on MDX components.
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:
The following script:
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:
export default function MDXContent() { return <p>Some MDX content</p> } MDXContent.isMDXComponent = true
The default export is a recma plugin. It takes no options.
This project is compatible with Node.js 20 or greater.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4