baynezy/Html2Markdown

Problem indexing empty <li>

Closed this issue · 3 comments

Report issue

I have an error with the following stack trace:

System.InvalidOperationException: Sequence contains no elements
at System.Linq.ThrowHelper.ThrowNoElementsException()
at System.Linq.Enumerable.Aggregate[TSource](IEnumerable1 source, Func3 func)
at Html2Markdown.Replacement.HtmlParser.ReplaceList(String html)
at Html2Markdown.Replacement.HtmlParser.ReplaceLists(String html)
at System.Linq.Enumerable.Aggregate[TSource,TAccumulate](IEnumerable1 source, TAccumulate seed, Func3 func)
at Html2Markdown.Converter.Convert(String html)

Steps to reproduce the problem

Use the following html:

"<h1>Adopt OKRs as a strategy execution framework</h1>
<h2>Channel: OPSP 2023</h2>
<h2>Tags: 2023Q3ROCKS</h2>
<p><strong>Ações</strong></p>\n<ul>\n<li>✅ <a
            href=\"https://www.site.pt">Apresentação</a>
        OKRs 101 </li>\n<li>✅ Titçe\n<ul>\n<li><img
                    src=\"https://www.site.pt"></li>\n
        </ul>\n</li>\n<li>✅ Definição de \"coaches\"\n<ul>\n<li>John Doe</li>\n</ul>\n
    </li>\n<li>✅ Subtitle\n<ul>\n<li>Q4 2023</li>\n</ul>\n</li>\n<li>🕒 Tool
\n<ul>\n<li>In evaluation</li>\n</ul>\n</li>\n</ul>"

Thanks

@miguelisidoro - I am having trouble recreating your issues.

See 3d5259c for details. This unit test passes and does not create your LINQ error. Can you send me a reproducible case to help me debug it?

This issue is stale because it has been open for 30 days with no activity.

This issue was closed because it has been inactive for 14 days since being marked as stale.