# Parsing Markdown lists add paragraph to items

**URL:** <https://discourse.julialang.org/t/parsing-markdown-lists-add-paragraph-to-items/36169>\
**Category:** General Usage\
**Tags:** question, documentation, markdown\
**Created:** [March 19, 2020, 12:50am UTC](https://discourse.julialang.org/t/parsing-markdown-lists-add-paragraph-to-items/36169 "2020-03-19T00:50:07Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![cdsousa](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cdsousa/32/215553_2.png) [@cdsousa](https://discourse.julialang.org/u/cdsousa)\
**Post date:** [March 19, 2020, 12:50am UTC](https://discourse.julialang.org/t/parsing-markdown-lists-add-paragraph-to-items/36169/1 "2020-03-19T00:50:07Z")

</div>

Hi all,

When parsing a Markdown list,

```julia
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
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:

```julia
<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?

---

<div class="post-metadata">

**Author:** ![cdsousa](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cdsousa/32/215553_2.png) [@cdsousa](https://discourse.julialang.org/u/cdsousa)\
**Post date:** [March 19, 2020, 10:33am UTC](https://discourse.julialang.org/t/parsing-markdown-lists-add-paragraph-to-items/36169/2 "2020-03-19T10:33:39Z")

</div>

This seems related: [Markdown parsing of newlines in bulleted list · Issue #30198 · JuliaLang/julia · GitHub](https://github.com/JuliaLang/julia/issues/30198)

---

<div class="post-metadata">

**Author:** ![tlienart](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tlienart/32/7640_2.png) [@tlienart](https://discourse.julialang.org/u/tlienart)\
**Post date:** [March 19, 2020, 11:09am UTC](https://discourse.julialang.org/t/parsing-markdown-lists-add-paragraph-to-items/36169/3 "2020-03-19T11:09:21Z")

</div>

> [@cdsousa](#):
>
> 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

```julia
ul li p {margin: 0}

```

 ![Screen Shot 2020-03-19 at 12.08.21](https://global.discourse-cdn.com/julialang/original/3X/8/4/84d0bf4ded5ff470bb89661b6923581ec9c98c7e.png)

```html
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)

---

<div class="post-metadata">

**Author:** ![cdsousa](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cdsousa/32/215553_2.png) [@cdsousa](https://discourse.julialang.org/u/cdsousa)\
**Post date:** [March 19, 2020, 4:36pm UTC](https://discourse.julialang.org/t/parsing-markdown-lists-add-paragraph-to-items/36169/4 "2020-03-19T16:36:25Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![tlienart](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tlienart/32/7640_2.png) [@tlienart](https://discourse.julialang.org/u/tlienart)\
**Post date:** [March 19, 2020, 6:36pm UTC](https://discourse.julialang.org/t/parsing-markdown-lists-add-paragraph-to-items/36169/5 "2020-03-19T18:36:50Z")

</div>

copying HTML to a docx 🤔 , does that even work? anyway good luck!
