Chetan Khulage
Chetan Khulage

Reputation: 39

How to Use Sent Props in Code Block Filename in Nextra 3.0 MDX?

I'm currently using Nextra version 3.0.0-alpha.28 for my documentation, and I'm trying to pass props to an MDX component. Specifically, I'm sending a prop like this:

<CssVariablesReact filePath={"example.mdx"} />

In the component, I can access this prop using {props.filePath} without any issues. However, I'm encountering a problem when trying to use this prop in a code block filename:

js showLineNumbers filename="{props.filePath}" copy {15-24,26,35-44,48-49}
// mycode

It seems that the {props.filePath} syntax does not work within the filename attribute of the code block.

How can I dynamically use props like filePath in the filename of a code block in Nextra 3.0 MDX?

Upvotes: 0

Views: 35

Answers (0)

Related Questions