HTML Tags (<br> specifically) after a header element breaks Markdown in following lines #434

Closed
opened 2026-01-29 14:36:36 +00:00 by claunia · 1 comment
Owner

Originally created by @RickStrahl on GitHub (Feb 5, 2021).

This is a minor inconsistency issue that a user reported to me in the Markdown Monster repository.

User was (kind of uselessly) placing explicit <br> characters after a block element like a header followed on a new line by text that includes markdown. MD treats this as an HTML block and displays the text as literal without expanding the markdown:

image

If however, if I space out the text then I get the correct behavior:

image

Finally if have two text blocks (instead of a header and textblock) MD does the right thing:

image

As said, I think this is a minor issue and not too concerned with it, but it does seem inconsistent. I suspect the issue here is mainly that in the last example there's some special handling for <br> to behave differently than other HTML tags, while for header (or other non-literal) tags that's not applied.

Babelmark seems to be split on 1. - I see about half the renderers rendering the rendered markdown vs. half rendering the literal text.

https://babelmark.github.io/?text=%23+This+is+some+text%0A%3Cbr%3E%0AThis+is+some+text.%0A

Not sure if it's worth fixing this as it is a bit of an edge case, but I thought I'd point it out since it was noticed in MM.

Originally created by @RickStrahl on GitHub (Feb 5, 2021). This is a minor inconsistency issue that a user [reported to me in the Markdown Monster repository](https://github.com/RickStrahl/MarkdownMonster/issues/751). User was (kind of uselessly) placing explicit `<br>` characters after a block element like a header followed on a new line by text that includes markdown. MD treats this as an HTML block and displays the text as literal without expanding the markdown: ![image](https://user-images.githubusercontent.com/1374013/107094630-741c1c80-67ab-11eb-98e2-b789ee75ce85.png) If however, if I space out the text then I get the correct behavior: ![image](https://user-images.githubusercontent.com/1374013/107094694-9150eb00-67ab-11eb-9b75-5bd1ff9ce8aa.png) Finally if have two text blocks (instead of a header and textblock) MD does the right thing: ![image](https://user-images.githubusercontent.com/1374013/107094828-ce1ce200-67ab-11eb-9996-3def3cd4dfab.png) As said, I think this is a minor issue and not too concerned with it, but it does seem inconsistent. I suspect the issue here is mainly that in the last example there's some special handling for `<br>` to behave differently than other HTML tags, while for header (or other non-literal) tags that's not applied. Babelmark seems to be split on 1. - I see about half the renderers rendering the rendered markdown vs. half rendering the literal text. https://babelmark.github.io/?text=%23+This+is+some+text%0A%3Cbr%3E%0AThis+**is+some+text**.%0A Not sure if it's worth fixing this as it is a bit of an edge case, but I thought I'd point it out since it was noticed in MM.
Author
Owner

@xoofx commented on GitHub (Feb 5, 2021):

It's not a bug, that's how CommonMark is working. See above in the link, all real CommonMark are handling it the same way as Markdig.

Related issue #509

@xoofx commented on GitHub (Feb 5, 2021): It's not a bug, that's how CommonMark is working. See above in the link, all real CommonMark are handling it the same way as Markdig. Related issue #509
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/markdig#434