-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove extra whitespace on lists containing p tags
Closes #359 May relate to #202 Massive thanks to https://github.com/YoussefAzaroual for most of the work in #359
- Loading branch information
Showing
10 changed files
with
106 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
src/Html2Markdown/Replacement/CommonMark/CommonMarkTextFormattingReplacementGroup.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
namespace Html2Markdown.Replacement.CommonMark; | ||
|
||
/// <summary> | ||
/// A group of IReplacer to deal with converting HTML for | ||
/// formatting text | ||
/// </summary> | ||
public class CommonMarkTextFormattingReplacementGroup : IReplacementGroup | ||
{ | ||
private readonly IList<IReplacer> _replacements = new List<IReplacer> { | ||
new StrongTagReplacer(), | ||
new EmphasisTagReplacer(), | ||
new ImageTagReplacer(), | ||
new CustomReplacer | ||
{ | ||
CustomAction = ReplaceLists | ||
}, | ||
new AnchorTagReplacer() | ||
}; | ||
|
||
private static string ReplaceLists(string html) | ||
{ | ||
return HtmlParser.ReplaceLists(html); | ||
} | ||
|
||
public IEnumerable<IReplacer> Replacers() | ||
{ | ||
return _replacements; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
...neOrderedListWithNestedParagraphsAndCodeElement_ThenReplaceWithMarkdownLists.verified.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
This code is with an ordered list and paragraphs. | ||
|
||
1. Yes, this is a `code` element | ||
2. No : | ||
|
||
* `Some code we are looking at` |
6 changes: 6 additions & 0 deletions
6
...rt_WhenThereIsAnOrderedListWithNestedParagraphs_ThenReplaceWithMarkdownLists.verified.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
This code is with an ordered list and paragraphs. | ||
|
||
1. Yes, this is a `code` element | ||
2. No : | ||
|
||
* `Some code we are looking at` |
6 changes: 6 additions & 0 deletions
6
...neOrderedListWithNestedParagraphsAndCodeElement_ThenReplaceWithMarkdownLists.verified.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
This code is with an ordered list and paragraphs. | ||
|
||
1. Yes, this is a `code` element | ||
2. No : | ||
|
||
* `Some code we are looking at` |
6 changes: 6 additions & 0 deletions
6
...rt_WhenThereIsAnOrderedListWithNestedParagraphs_ThenReplaceWithMarkdownLists.verified.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
This code is with an ordered list and paragraphs. | ||
|
||
1. Yes, this is a `code` element | ||
2. No : | ||
|
||
* `Some code we are looking at` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters