-
Hi, This is perhaps a question for @wooorm as I have been reading the "HTML and remark" recipe page and I saw your name against it. Using the recipe code, convering HTML to Markdown and then converting the resulting Markdown back to HTML does not result in the original HTML. See this CodeSandbox for an example of this behaviour - starting with the HTML string I think the problem comes from converting the initial HTML to Markdown - I end up with I couldn't see any relevant options that could be applied to any of the rehype or remark packages to fix this behaviour. Have you had a similar issue before? Any ideas how to fix it? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
The problem is that markdown can’t really represent that HTML. As you noted. There is a nice way around it: improve the HTML you have. Don’t put that space there. There is one automatic way around it, but it is extremely ugly. It’s to turn: <strong>Hello </strong>world Into **Hello **world Which renders as: Hello world I’ve laid the solution out in https://github.com/orgs/syntax-tree/discussions/60#discussioncomment-2111096. It’s quite complex to wrap your head around though. Solving it would go in https://github.com/syntax-tree/mdast-util-to-markdown. |
Beta Was this translation helpful? Give feedback.
The problem is that markdown can’t really represent that HTML. As you noted. There is a nice way around it: improve the HTML you have. Don’t put that space there.
There is one automatic way around it, but it is extremely ugly. It’s to turn:
Into
Which renders as: Hello world
I’ve laid the solution out in https://github.com/orgs/syntax-tree/discussions/60#discussioncomment-2111096. It’s quite complex to wrap your head around though. Solving it would go in https://github.com/syntax-tree/mdast-util-to-markdown.