Closed dmitryshelomanov closed 2 years ago
Impossible
@wooorm
why ? I have tree and can traverse it
traverse(tree, components)
I thought such libraries already exist
Yes, you can do such things. Your question is vague. This project doesn’t do that. This project compiles MDX -> JS.
I need compile's tree
If you are looking for direct access to the abstract syntax tree https://github.com/mdx-js/mdx/tree/main/packages/remark-mdx can be used
render it in react
If your goal is to render it, consider directly rendering it fully serverside or rendering it fully client side. Trying a hybrid client-server approach, sending the AST between them, without a reason, probably isn't a good idea.
You may want to look into something like https://wooorm.com/server-components-mdx-demo as an alternative way to have a static page, with a few dynamic elements.
I want to try crate editor with tree from server api
It's unclear what you mean by this. Editors generally run fully client side.
(I need light weight render without evulate and etc)
MDX/XDM can render server side, though the round trip time likely wouldn't be ideal for an editor experience.
I need compile's tree and render it in react I want to try crate editor with tree from server api (I need light weight render without evulate and etc)