Reason for starting an HTML block when the closing tag ends the same line?

For example, this:


In the example above, the first line starts an HTML block, so the second line is not bold.

I can see at least a couple of reasons for not starting an HTML block when the starting tag is closed/self-closed on the same line:

  1. No other popular markdown implementation behaves this way (GitHub, Stackoverflow, Discourse, etc), so this is confusing to the users.
  2. It makes writing plugins that pre-process Markdown harder. E.g. if the plugin replaces all imgur/youtube links with images/videos, the plugin needs to account for whether empty lines should be added around it depending on the type of the tag inserted and on whether the link is in the beginning of the line.

Why does the spec mandate this? Let’s change it?

Here is a more complete example for what I think the spec should result in:

<p>**Not processed**</p>
<div/> **Processed?**
1 Like

I like the idea very much — the biggest concern is probably that it requires the Markdown processor to understand what the closing tag looks like.

I don’t think this should be a dealbreaker — GitHub’s pre-CommonMark Markdown parser did exactly this (search until it found a closing tag — although we still required a following blank line), and I think it’s not out of scope given the main output format is HTML, and we already have HTML-specific parsing rules.

Also linking the source issue that started thinking along these lines: