Hyphen on a new line doesn't return correct html #480

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

Originally created by @conceptworld on GitHub (Aug 11, 2021).

If I send the following plain text to Markdown.ToHtml:

First line\nSecond line\n-

(Notice that there is single hyphen in a new line above)

Then the method returns

<h2>First lineSecond line</h2>

There are no <br> for new lines and h2 is applied to all the lines above the hyphen.

This is a major issue as many users use hyphens for simple demarcation.

Also I don't think single hyphen should work this way. 2 or 3 hyphens should result in markdown formatting.

Thanks.

Originally created by @conceptworld on GitHub (Aug 11, 2021). If I send the following plain text to Markdown.ToHtml: First line\nSecond line\n- (Notice that there is single hyphen in a new line above) Then the method returns &lt;h2&gt;First lineSecond line&lt;/h2&gt; There are no &lt;br&gt; for new lines and h2 is applied to all the lines above the hyphen. This is a major issue as many users use hyphens for simple demarcation. Also I don't think single hyphen should work this way. 2 or 3 hyphens should result in markdown formatting. Thanks.
claunia added the invalid label 2026-01-29 14:37:48 +00:00
Author
Owner

@xoofx commented on GitHub (Aug 11, 2021):

All CommonMark implementation should follow the same behavior (unless we broke something recently in markdig) as shown on babelmark

There are no
for new lines and h2 is applied to all the lines above the hyphen.
This is a major issue as many users use hyphens for simple demarcation.
Also I don't think single hyphen should work this way. 2 or 3 hyphens should result in markdown formatting.

This is the specs we are following https://spec.commonmark.org/0.29/#thematic-breaks

@xoofx commented on GitHub (Aug 11, 2021): All CommonMark implementation should follow the same behavior (unless we broke something recently in markdig) as shown on [babelmark](https://babelmark.github.io/?text=First+line%0ASecond+line%0A-%0A%0A) > There are no <br> for new lines and h2 is applied to all the lines above the hyphen. > This is a major issue as many users use hyphens for simple demarcation. > Also I don't think single hyphen should work this way. 2 or 3 hyphens should result in markdown formatting. This is the specs we are following https://spec.commonmark.org/0.29/#thematic-breaks
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/markdig#480