toptensoftware / markdowndeep

Open-source implementation of Markdown for C# and Javascript
268 stars 120 forks source link

Trailing spaces causes exception when plain-text transforming #70

Open Baxxis opened 8 years ago

Baxxis commented 8 years ago

When using plain-text transformations, trailing spaces seem to throw an exception. To fix this issue, we can trim the text before issuing the transform.

This throws the exception:

var markdownTransformer = new Markdown();
markdownTransformer.ExtraMode = true; 

markdownTransformer.SummaryLength = -1;
string html = markdownTransformer.Transform(text);

Trimming the text prevents the exception:

string html = markdownTransformer.Transform(text.Trim());