Fix parsing Markdown in HTML - #135
Conversation
|
I tried something that didn't work so I thought I'd share the blockers. I've been relying on the CommonMark Spec and more specifically an example from the spec for HTML blocks. Ideally, we should parse Markdown in HTML blocks that start and end with a line break. The problem is that we are cleaning the input string with htmlclean which removes those line breaks. This sanitization is required to avoid interpreting meaningless code formatting which leads to undesired white spaces and nodes. I am now thinking about cleaning the HTML through the HTML parser itself. I'll give it a shot. |
|
I'm not sure that we can properly clean the HTML by chunk (through the parser). |
A user reported an issue where the Markdown content of an HTML node (within a Markdown file) is not parsed. The goal of this PR is to fix that.
We already parse HTML in Markdown so it would make sense to parse Markdown in HTML. Here's an example of Markdown containing HTML containing Markdown, which is properly parsed by GitHub:
This div contains Markdown with a link and some bold content.
Source:
Note that the linebreaks matter, the following:
Yields: