How do I parse an html fragment? #69
-
Say I have some arbitrary html such as parentless text node
<b>
hello world
</b>
<p>
<s>nested text node</s>
</p> Seems that when I run this through rehype everything gets nested in I can drill down into the AST to supply just the body node to the parser, but if I try to drill down into the children this ends up with
React's I have an example here https://codesandbox.io/s/purple-cache-flpie0?file=/src/index.js |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Hi, this first of all seems like a XY problem. What is the problem instead of the attempted solution? Your example also shows some custom logic to add styles but I would recommend using this: rehype-document/#example-css You also mention working with React, for which you could look at react-markdown. |
Beta Was this translation helpful? Give feedback.
-
problem isn't related to this lib at all i found out |
Beta Was this translation helpful? Give feedback.
problem isn't related to this lib at all i found out