rehype-pretty-code
rehype-pretty-code copied to clipboard
Pass variable as content in MDX ?
I want to pass a variable to rehype-pretty-code as content in MDX,
something like this:
```mdx title="Demo.mdx"
{frontmatter.rawmdx}
\```
frontmatter.rawmdxis created byastro-m2dx
Is It possible?
some imagine syntax:
```mdx title="Demo.mdx" content={frontmatter.rawmdx}
\```
I don't think metastrings can contain variable content; they're just raw strings.
What we can do is allow a map of the variable content in the options:
const options = {
contentMap: {
test: '// comment',
}
};
```js contentKey="test"
```
Would this work?
Best option now is just to use a component to pass runtime values (server or client): https://rehype-pretty-code.netlify.app/#react-server-component