Skip to content

Help with MDX richtext editor #101

Answered by wooorm
konsumer asked this question in Q&A
Apr 4, 2023 · 3 comments · 4 replies
Discussion options

You must be logged in to vote

[…] as a sidenote, with renderToStaticNodeStream or similar […] I am trying to make HTML that represents the MDX in the RTE

With the first (renderToStaticNodeStream) you are evaluating things.
With the second, you are not.

MDX includes JavaScript. Such as {1 + 1}. What do you want in your output?
2 or {1 + 1}? What about:

import data from './data.js'

<div id={data.id} />

How do you want to represent that in HTML?
And how do you want to convert that back?

You can completely do this. I am just not sure how you want to go about it.

I think my problem is that I am making a rehype plugin, but once it gets to rehypeRemark (to convert the hast to mdast) it strips out the unknown mdxJsxFlowE…

Replies: 3 comments 4 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
4 replies
@konsumer
Comment options

@konsumer
Comment options

@wooorm
Comment options

Answer selected by konsumer
@konsumer
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants