-
-
Notifications
You must be signed in to change notification settings - Fork 0
Convert MD to MDX? #9
Comments
Super interesting idea! The start of the process would be remark-parse, remark-rehype (w/ The missing part then would be based on The last part then is using |
That's beyond my ability 😄. But thanks for all the hints! |
Oh I forgot about this! https://github.com/mapbox/jsxtreme-markdown/tree/main/packages/hast-util-to-jsx#readme. |
It’s now possible to turn HTML into JavaScript with https://github.com/syntax-tree/hast-util-to-estree. Markdown to HTML can already be done, including raw embedded HTML. But still, the MDX source format is different from the MD source format. This idea post is about converting between them, but from the the linked issue, it sounds like an XY problem, and that you’re in fact looking to allow different parsers in docusaurus. |
Yes, facebook/docusaurus#3018 is about Docusaurus supporting multiple parsers. This idea is more low-level, enabling any tool that currently works with MDX only to also work with MD. |
Thanks for starting the discussion @borekb! |
Is there a utility in the unified ecosystem to convert Markdown (CommonMark) to MDX?
We're looking for a way to feed our Markdown files that contain things like
<img src="">
or<br>
or<span style="color: red">
to a tool that only accepts MDX, and those things would currently be parse errors.(I'm not sure if it's even possible to safely convert CommonMark to MDX, maybe there are edge cases that I don't realize. But someone here will probably know better than me...)
The text was updated successfully, but these errors were encountered: