-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Labels
🐛 type/bugThis is a problemThis is a problem
Description
With the new inline parsing of JSX blocks we no longer allow props access like we did in v0:
This is some inline JSX: <span>{props.foo}</span>We now result in the following AST:
{
"type": "root",
"children": [
{
"type": "paragraph",
"children": [
{
"type": "text",
"value": "This is some inline JSX: "
},
{
"type": "jsx",
"value": "<span>"
}
{
"type": "text",
"value": "{props.foo}",
},
{
"type": "jsx",
"value": "</span>"
}
}
}
]
}This is problematic because "{props.foo}" will be escaped and end up like:
<span>{`{props.foo}`}</span>Potential solution
Rather than parsing open/close blocks separately we should probably return a single node:
{
type: 'jsx',
value: '<span>{props.foo}</span>`
}However, this can be problematic if folks are using Markdown inside inline JSX because their embedded Markdown will suddenly no longer work. This is also why remark parses inline HTML in that way. In the context of MDX, though, I'm not sure this is correct and we want it as a single JSX node.
cc/ @ChristopherBiscardi @wooorm @timneutkens @jxnblk @jlengstorf
Metadata
Metadata
Assignees
Labels
🐛 type/bugThis is a problemThis is a problem