Hard line breaks

edit

In CommonMark, the lines of a paragraph are joined: a line break needs two spaces or a backslash at the end of the line. People who write comments or messages expect a new line to stay a new line. HardLineBreaks renders every line break of a paragraph as <br />.

var options = new MarkdownParseOptions { Extensions = MarkdownExtensions.HardLineBreaks };
var tree = MarkdownSyntaxTree.ParseText("Roses are red,\nViolets are blue.\n", options);

Assert.Equal("<p>Roses are red,<br />\nViolets are blue.</p>\n", MarkdownHtmlRenderer.ToHtml(tree));

The syntax tree does not change: only the renderer writes the line breaks differently.