Skip to content

Commit

Permalink
Upgrade HAP to latest version
Browse files Browse the repository at this point in the history
Had to fix some issues with the logic in HAP as it
has changed.

Fixes #81
Fixes #117
Closes #119
  • Loading branch information
baynezy committed Nov 18, 2021
1 parent ca12798 commit d712f7f
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
Binary file added .vs/Html2Markdown/v16/TestStore/0/000.testlog
Binary file not shown.
Binary file added .vs/Html2Markdown/v16/TestStore/0/testlog.manifest
Binary file not shown.
2 changes: 1 addition & 1 deletion src/Html2Markdown/Html2Markdown.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="HtmlAgilityPack" Version="1.5.0" />
<PackageReference Include="HtmlAgilityPack" Version="1.11.38" />
</ItemGroup>

</Project>
12 changes: 10 additions & 2 deletions src/Html2Markdown/Replacement/HtmlParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -261,14 +261,22 @@ private static HtmlDocument GetHtmlDocument(string html)

private static void ReplaceNode(HtmlNode node, string markdown)
{
var markdownNode = HtmlNode.CreateNode(markdown);
if (string.IsNullOrEmpty(markdown))
{
node.ParentNode.RemoveChild(node);
}
else
{
node.ParentNode.ReplaceChild(markdownNode.ParentNode, node);
var temp = HtmlNode.CreateNode("<p></p>");
temp.InnerHtml = markdown;
var current = node;

foreach (var child in temp.ChildNodes)
{
node.ParentNode.InsertAfter(child, current);
current = child;
}
node.Remove();
}

}
Expand Down

0 comments on commit d712f7f

Please sign in to comment.