ReverseMarkdown.Net is a Html to Markdown converter library in C#. Conversion is very reliable since HtmlAgilityPack (HAP) library is used for traversing the Html DOM
MIT License
270
stars
62
forks
source link
Conversion fails when HTML tag has duplicate props #351
System.ArgumentException at ReverseMarkdown.StringUtils.ParseStyle is thrown with the message "An item with the same key has already been added. Key: \n ".
This is possibly an intended behavior but perhaps a check for key-value pair already exists can solve cases like that.
Full stack:
System.ArgumentException: An item with the same key has already been added. Key: <prop name>
at System.Collections.Generic.Dictionary`2.TryInsert(TKey key, TValue value, InsertionBehavior behavior)
at System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value)
at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector, IEqualityComparer`1 comparer)
at ReverseMarkdown.StringUtils.ParseStyle(String style)
at System.Linq.Enumerable.SelectListIterator`2.MoveNext()
at ReverseMarkdown.Converters.Tr.UnderlineFor(HtmlNode node, String indent)
at ReverseMarkdown.Converters.Tr.Convert(HtmlNode node)
at ReverseMarkdown.Converters.ConverterBase.<TreatChildren>b__4_0(String current, HtmlNode nd)
at System.Linq.Enumerable.Aggregate[TSource,TAccumulate](IEnumerable`1 source, TAccumulate seed, Func`3 func)
at ReverseMarkdown.Converters.ConverterBase.<TreatChildren>b__4_0(String current, HtmlNode nd)
at System.Linq.Enumerable.Aggregate[TSource,TAccumulate](IEnumerable`1 source, TAccumulate seed, Func`3 func)
at ReverseMarkdown.Converters.Table.Convert(HtmlNode node)
at ReverseMarkdown.Converters.ConverterBase.<TreatChildren>b__4_0(String current, HtmlNode nd)
at System.Linq.Enumerable.Aggregate[TSource,TAccumulate](IEnumerable`1 source, TAccumulate seed, Func`3 func)
at ReverseMarkdown.Converters.Div.Convert(HtmlNode node)
at ReverseMarkdown.Converters.ConverterBase.<TreatChildren>b__4_0(String current, HtmlNode nd)
at System.Linq.Enumerable.Aggregate[TSource,TAccumulate](IEnumerable`1 source, TAccumulate seed, Func`3 func)
at ReverseMarkdown.Converter.Convert(String html)
System.ArgumentException at ReverseMarkdown.StringUtils.ParseStyle is thrown with the message "An item with the same key has already been added. Key: \n".
This is possibly an intended behavior but perhaps a check for key-value pair already exists can solve cases like that.
Full stack:
Thanks!