Html2Markdown
Html2Markdown copied to clipboard
Nested list render issue
Report issue
I tried the following html, and the actual result has an extra asterisk on the first child of the nested list.
<ul>
<li>Apple</li>
<li>Microsoft</li>
<ul>
<li>IBM</li>
<li>Cisco</li>
</ul>
</ul>
Expected behavior
- Apple
- Microsoft
- IBM
- Cisco
Actual Behaviour
- Apple
- Microsoft
-
- IBM
- Cisco
Steps to reproduce the problem
You can see incorrect output live at https://jbt.github.io/markdown-editor/#01JQUHAsKMhJ5dICsnwzk4vyi/PTSsA8EPZ08uVSgLKdM4uT8wE=
Or you can run the following code to reproduce
var html = @"
<ul>
<li>Apple</li>
<li>Microsoft</li>
<ul>
<li>IBM</li>
<li>Cisco</li>
</ul>
</ul>
";
var converter = new Html2Markdown.Converter();
var markdown = converter.Convert(html);
@baynezy Looking at the issue again, my html input is wrong. This Stackoverflow question is helpful explaining the correct way to do nested html list. I got my html input from Open Live Writer, so I overlooked it. There is still a minor issue.
Now with my code
var html = @"<ul>
<li>Item1
<ul>
<li>Item2</li>
</ul>
</li>
</ul>";
var converter = new Html2Markdown.Converter();
string result = converter.Convert(html);
I got the follwing markdown output
* Item1
* Item2
One minor issue, there is an extra line between item1 and item2. Thank you.
@FanrayMedia - thanks for this. It looks like fixing this requires me to complete #68, so I would watch that issue as well.
Hi @baynezy. First of all thanks for publishing this great library as it saves us a significant amount of time to develop the HTML<->Markdown conversion we need. However, currently we're facing this nested list issue as well as the extra new line makes a significant difference in the conversion for us. Do you have any idea once this will be resolved?