Skip to content

Markdown to HTML and vice versa #208

Answered by wooorm
peter-oms asked this question in Q&A
Discussion options

You must be logged in to vote

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&#x20;**&#x77;orld

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.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by ChristianMurphy
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