-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
Initial checklist
- I read the support docs
- I read the contributing guide
- I agree to follow the code of conduct
- I searched issues and discussions and couldn’t find anything (or linked relevant results below)
Problem
Since @mdx-js/mdx
is more high-level, I usually use remark-mdx
for unit tests for my own remark mdx plugins.
I noticed an inconsistency when parsing MDX inline content, like:
<Comp>Text</Comp>
<Comp>
Text
</Comp>
In remark-mdx
, the former one is a flow text element, while latter one is a JSX flow element.
But when using @mdx-jd/mdx
, where my remark plugins run, they became both JSX flow element.
I would have expected it's a parse-level behaviour as it's about how JSX syntax being handled, but after checking, the work is done by an internal remark plugin to unravel JSX text elements.
Current solutions
Copy the remark unravel plugin from this repository, or using another existing plugins.
But they're not parser, which causes processor.parse
to handle syntax like:
<Comp>Text</Comp>
as inline elements, and created inconsistency when I use remark().use(remarkMdx)
instead.
The result is a bit unintuitive because it's enabled by default by MDX.js, and cannot be disabled at all.
Proposed solutions
An option to remarkMdx
to specify how to handle those JSX syntax. (or consider enabling it by default)