specification
specification copied to clipboard
Introduce evaluated code block for JSX
Considering the fact that most tooling doesn't support MDX syntax, perhaps it makes sense to introduce an official way to introduce JSX blocks that render nicely with existing MD tools.
@jamiebuilds brings up a great point about how we can make a small, optional change to MDX in order to have JSX blocks work more seamlessly.
I like the idea of something along the lines of what Jamie proposes, using metadata to indicate the code block should be evaluated. This is something we discussed in the original spec, but decided to punt on for the initial release.
Language
/jsx?/
Metadata
render=trueeval=true
```js render=true
I believe we want this to land for code block infostring parsing -- https://github.com/remarkjs/remark/pull/345
@ChristopherBiscardi The info string is already supported, just not split on that one space. I’m sure we could work around it already! But anyway, probably going to land in a couple days, waiting on a couple more things first!
Dope! my mistake :) I'll look further into how it currently works
I completely agree with this assessment, though I wonder if this should be done under the name of MDX or as a separate initiative since MDX has started gaining dev market share on a number of fronts and this would presumably be a large, breaking change that would not be backwards-compatible with existing projects.
I believe that those code blocks are easier for type checking
```ts
<Component >
```
We can strip out those blocks and feed it to type checker. Related https://github.com/mdx-js/specification/issues/16