Skip to content

Commit

Permalink
Fix GH-281 extra blank lines in output
Browse files Browse the repository at this point in the history
  • Loading branch information
mysticmind committed Apr 11, 2022
1 parent 5944c2e commit 5073182
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
1. Paragraph 1

Paragraph 1.1

Paragraph 1.2
2. Paragraph 3
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
This text has


. This text appear after header.
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
This text has pre tag content



Next line of text
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
This text has pre tag content
This text has pre tag content

```
Expand Down
4 changes: 4 additions & 0 deletions src/ReverseMarkdown/Converter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text.RegularExpressions;
using HtmlAgilityPack;
using ReverseMarkdown.Converters;

Expand Down Expand Up @@ -56,6 +57,9 @@ public string Convert(string html)

var result = Lookup(root.Name).Convert(root);

// cleanup multiple new lines
result = Regex.Replace( result, @"(^\p{Zs}*(\r\n|\n)){2,}", Environment.NewLine, RegexOptions.Multiline);

return result.Trim();
}

Expand Down

0 comments on commit 5073182

Please sign in to comment.