Html2Markdown
Html2Markdown copied to clipboard
Exception with HTML that comes from the clipboard
Report issue
I'm trying to use Html2Markdown on HTML that is copied from a website (clipboard HTML format). However, Html2Markdown/HtmlAgilityPack (not sure where the bug is in) throws an exception.
Expected behavior
Result similar to https://codebeautify.org/html-to-markdown/cbb0fda9
Actual Behaviour
Exception
Exception: Multiple node elements can't be created.
HtmlAgilityPack.HtmlNode.CreateNode (System.String html, System.Action`1[T] htmlDocumentBuilder) (at <903ced6079614df5aab1b4a40359cb4d>:0)
HtmlAgilityPack.HtmlNode.CreateNode (System.String html) (at <903ced6079614df5aab1b4a40359cb4d>:0)
Html2Markdown.Replacement.HtmlParser.ReplaceNode (HtmlAgilityPack.HtmlNode node, System.String markdown) (at <3abb406beb91401bb594269295dbfa9a>:0)
Html2Markdown.Replacement.HtmlParser+<>c.<ReplacePre>b__4_0 (HtmlAgilityPack.HtmlNode node) (at <3abb406beb91401bb594269295dbfa9a>:0)
System.Collections.Generic.List`1[T].ForEach (System.Action`1[T] action) (at <695d1cc93cca45069c528c15c9fdd749>:0)
Html2Markdown.Replacement.HtmlParser.ReplacePre (System.String html) (at <3abb406beb91401bb594269295dbfa9a>:0)
Html2Markdown.Replacement.CustomReplacer.Replace (System.String html) (at <3abb406beb91401bb594269295dbfa9a>:0)
Html2Markdown.Converter+<>c.<Convert>b__5_0 (System.String current, Html2Markdown.Replacement.IReplacer element) (at <3abb406beb91401bb594269295dbfa9a>:0)
System.Linq.Enumerable.Aggregate[TSource,TAccumulate] (System.Collections.Generic.IEnumerable`1[T] source, TAccumulate seed, System.Func`3[T1,T2,TResult] func) (at <351e49e2a5bf4fd6beabb458ce2255f3>:0)
Html2Markdown.Converter.Convert (System.String html) (at <3abb406beb91401bb594269295dbfa9a>:0)
Steps to reproduce the problem
Call Converter.Convert on the HTML listed here: https://codebeautify.org/html-to-markdown/cbb0fda9 (copied from the GitHub Readme page of Html2Markdown, you can extract Clipboard HTML format using https://www.nirsoft.net/utils/inside_clipboard.html)