Open andrii-bodnar opened 2 months ago
I referred to the MDX's using MDX guidelines:
‡ The rules for whether a name in JSX (so x in
) is a literal tag name (like h1) or not (like Component) are as follows:
- If there’s a dot, it’s a member expression (<a.b> → h(a.b)), which means a reference to the key b taken from object a.
- Otherwise, if the name is not a valid JS identifier, it’s a literal (
→ h('a-b')). - Otherwise, if it starts with a lowercase, it’s a literal ( → h('a')).
- Otherwise, it’s a reference ( → h(A)).
My guess is as follows:
<test>
starts with a lowercase letter, so MDX treats it as an HTML tag and compiles it to _jsx('test')
instead of _jsx(test)
.remark-headings
plugin, which determines the headings based on the ESM exports.I think a simple solution would be to rename test
to UpperCamelCase so that MDX can correctly parse it as a component:
import Test from './test.mdx'
<Test />
I have some common parts in my documentation that I would like to import as separate files. It's possible according to this.
But when I import the mdx file into another mdx, the imported content doesn't show up, just headings get mixed up with the original page heading.
For example, I have the following
test.mdx
:And I import it into the Introduction page:
Result: