2 ms·
> As soon as you open a HTML tag, you can just treat its insides as HTML. That is not entirely true. There are some edge cases to consider and while considerin
by susam 5y ago
> As soon as you open a HTML tag, you can just treat its insides as HTML.
That is not entirely true. There are some edge cases to consider and while considering edge cases, we first need to decide which Markdown flavour we want to use. Some of us also need to consider if we are willing to commit to that Markdown flavour for the next 10, 20, 30 years or so because we do not want to "fix" our content again when some content rendering breaks due to edge cases when we switch from one Markdown renderer to another. The multiple flavours of Markdown handle several edge cases in different ways.
Let us pick CommonMark as the Markdown flavour for this comment. Here is an interesting edge case that is relevant to your comment. Consider the following Markdown input:
<div>
*foo*
</div>
The above Markdown input is rendered as the following HTML output:
<div>
*foo*
</div>
Now consider the following Markdown input:
<div>
*foo*
</div>
This is rendered as the following HTML output:
<div>
<p><em>foo</em></p>
</div>
One can use https://spec.commonmark.org/dingus/ https://spec.commonmark.org/dingus/ to test these examples.
So as soon as we open an HTML tag, we can't just treat everything inside it as plain HTML. The content within the HTML tags may get interpreted as Markdown as shown in the second example above. Now granted, all of this is clearly specified in the CommonMark specification and these edge cases are handled in this manner for good reasons (such as providing a way to use Markdown syntax within HTML tags, in the above example). But one has to understand the specification very well and keep these edge cases in mind while mixing HTML and Markdown.
For many people, these edge cases are not a problem because they write simple Markdown that would probably get rendered the way they expect, without any surprises. I can understand why many people prefer to use Markdown to write their website content. But there are also some of us, who find this extra complexity to be not worth it, especially because editing plain HTML files is nearly as easy, if not more, with a good editor (Emacs, in my case).