Hi all,
When parsing a Markdown list,
julia> m = Markdown.parse("- qwe\n- rty")
each item gets its own paragraph.
The HTML conversion of the list includes the paragraphs (<p></p>
) in each item too:
julia> println(Markdown.html(m))
<ul>
<li><p>qwe</p>
</li>
<li><p>rty</p>
</li>
</ul>
That is not the usual output one gets with other Markdown parsers, which would be something more like:
<ul>
<li>qwe</li>
<li>rty</li>
</ul>
The 2 HTML codes will render lists that look different from each other.
Does anyone know how to avoid this?
While this is probably not what you want to read, you can use CSS to make the difference invisible in the two, something like
ul li p {margin: 0}
A
<style>
ul li p {margin:0}
</style>
<ul>
<li><p>qwe</p>
</li>
<li><p>rty</p>
</li>
</ul>
B
<ul>
<li>qwe</li>
<li>rty</li>
</ul>
of course this may not be very satisfactory but I don’t think fixing the markdown parser is high on the priority list
(I tend to use this a fair bit but inside a div
so that it doesn’t leak elsewhere)
1 Like
Thanks @tlienart, it indeed helps in something I need just HTML.
On the other hand, it doens’t works in another use case where I copy the HTML to a DOCX doc, but that is also problem of how the WPS Office intreprets the HTML (It works ok with MS Office).
Thanks!
copying HTML to a docx , does that even work? anyway good luck!
1 Like