Closed citrus327 closed 2 years ago
I will do if I have time, thanks.
Hey, I'm also a big fan of MDX
😀
Provide 'rax/jsx-runtime' exactly like React did in the new jsx transforming
For what you metioned above in step 1, did you try options.pragma
to be compatible with current version of Rax?
{
jsxRuntime: 'classic',
pragma: 'Rax.createElement',
pragmaFrag: 'Rax.Fragment',
pragmaImportSource: 'rax'
}
If it works, in theory, we only need to provide some package like @mdx-js/rax
which exports MdxProvider
/... to combine Rax with MDX. If you haven't started working on @mdx-js/rax
yet, refer to @mdx-js/preact, it's only 93 lines, hope it helps
FYI: you also metioned remark/rehype plugins
, they are all about handling markdown and html syntax, it's irrelevant to Rax I think
@fengzilong I thought about the pragma, and I'm still trying to get rax into this. For the MdxProvider, I will check @mdx-js/preact. Thank you for the tip. I haven't got time for this, but sure i will check that later. XD
And for the remark/rehype plugins, sure it's irrelevant to rax.
Mdx is a way to write React(or jsx) code in markdown, it can be used with remark/rehype plugins, which is a huge ecosystem.
I've checked some source code of our component document demo implementation, which separate each coding blocks using Regex, then compile them and combine the raw markdown part(using marked). This approach is a bit hacky.
I think embracing unified ecosystem is such a nice move in the future.
Is your feature request related to a problem? Please describe. No
Describe the solution you'd like