A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.npmjs.com/package/rehype-mdx-code-props below:

rehype-mdx-code-props - npm

This plugin interprets markdown code block metadata as JSX props.

```js copy filename="awesome.js" onOpen={props.openDemo} {...props}
console.log('Everything is awesome!')
```
import { readFile } from 'node:fs/promises'

import { compile } from '@mdx-js/mdx'
import rehypeMdxCodeProps from 'rehype-mdx-code-props'

const { value } = await compile(await readFile('example.mdx'), {
  jsx: true,
  rehypePlugins: [rehypeMdxCodeProps]
})
console.log(value)

The <pre /> element doesn’t support those custom props. Use custom components to give the props meaning.

This package has a default export rehypeMdxCodeProps.

An MDX rehype plugin for transforming markdown code meta into JSX props.

This plugin works with Node.js 16 or greater and MDX 3.


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