-
I imagine converting the jsx and JavaScript expressions might be too much of a reach. What about something that approximates how mdx-js evaluates markdown (with say, gfm plugin), but in reverse? I been hacking something basic for a copy paste function, but having something more supported would be nice! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Something that mixes https://github.com/syntax-tree/hast-util-to-estree which turns hast elements to jsx elements, but then you need to turn them into the mdast mdx jsx nodes, combined with hast-util-to-mdast? But what is the reason? |
Beta Was this translation helpful? Give feedback.
-
I'm currently using this unified processor to convert a richtext pastebin to mdx automatically inside a textarea, but not sure if there's a better way to match how mdx compiles. unified()
.use(rehypeParse)
.use(fixGoogleHtml)
.use(rehypeRemark)
.use(remarkGFM)
.use(remarkStringify, {
resourceLink: true,
rule: "-",
ruleRepetition: 5,
fences: true,
}); In the long term, I can imagine an mdx editor where "editing the live preview reflects the changes back into mdx" would be very powerful. |
Beta Was this translation helpful? Give feedback.
I'm currently using this unified processor to convert a richtext pastebin to mdx automatically inside a textarea, but not sure if there's a better way to match how mdx compiles.
In the long term, I can imagine an mdx editor where "editing the live preview reflects the changes back into mdx" would be very powerful.