-
-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Swap out HTML component for another #31
Comments
Are you talking about HTMLElement nodes and not React nodes? They're pretty much destroyed/forgotten after the initial parse, as I build a new tree. Do you have a pseudo example by chance? |
So, I expect to have original HTML source like:
My aim is to end up with a React tree like:
How that actually happens, I don't mind. Matchers seem like a natural way to do this, bar the fact they're operating on node content rather than the original HTML content. If I had Ideally, I'd be able to have a matcher-style object which receives nodes instead of text. Once the initial parse is complete, I don't care about the nodes, only my React element. |
I think what I'm looking for is the equivalent of react-html-parser's transform. I'll take a look at adding something similar. |
I’d like to be able to swap out certain components for others. As far as I can tell, matchers only let you do this inside the text content of nodes, not adjust the nodes themselves.
(Specifically, I want to match lists with a class and swap them out for an interactive React component instead, to enable GitHub-style task lists.)
The text was updated successfully, but these errors were encountered: