Markdown lists under each other

2019-08-13 14:27发布

问题:

* foo
* bar

produces

<ul>
  <li>foo</li>
  <li>bar</li>
</ul>

and

* foo

* bar

produces

<ul>
  <li><p>foo</p></li>
  <li><p>bar</p></li>
</ul>

while I want

<ul>
  <li><p>foo</p></li>
</ul>
<ul>
  <li><p>bar</p></li>
</ul>

What's the solution?

回答1:

Since the majority of markdown implementations support the HTML, you can just use the comment between two lists, so it would be the safest and cleanest possible solution for this issue.

Like this:

* a

<!-- -->

* b

However, that won't give you the <p>, so if you'd really need them, you'd need to use the inline HTML here.

* <p>a

<!-- -->

* <p>b

(in most implementations you won't need to close the <p> in markdown — they would be closed automatically by markdown)

Here is a live second example using the stackoverflow's markdown:

  • a

  • b



标签: markdown