PreserveEmptyLines

MarkdownLoadOptions.PreserveEmptyLines property

Gets or sets a boolean value indicating whether to preserve empty lines while load a Markdown document. The default value is false.

Normally, empty lines between block-level elements in Markdown are ignored. Empty lines at the beginning and end of the document are also ignored. This option allows to import such empty lines.

public bool PreserveEmptyLines { get; set; }

Examples

Shows how to preserve empty line while load a document.

string mdText = $"{Environment.NewLine}Line1{Environment.NewLine}{Environment.NewLine}Line2{Environment.NewLine}{Environment.NewLine}";
using (MemoryStream stream = new MemoryStream(Encoding.UTF8.GetBytes(mdText)))
{
    MarkdownLoadOptions loadOptions = new MarkdownLoadOptions() { PreserveEmptyLines = true };
    Document doc = new Document(stream, loadOptions);

    Assert.AreEqual("\rLine1\r\rLine2\r\f", doc.GetText());
}

See Also