Markdown 列表在彼此之下

发布于 2024-12-13 00:20:15 字数 548 浏览 2 评论 0原文

* foo
* bar

生产

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

* foo

* bar

生产

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

在我想要的时候

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

解决方案是什么?

* 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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

笨笨の傻瓜 2024-12-20 00:20:15

由于大多数 Markdown 实现都支持 HTML,因此您可以只使用两个列表之间的注释,因此这将是解决此问题的最安全、最干净的解决方案。

像这样:

* a

<!-- -->

* b

但是,这不会为您提供

,因此如果您确实需要它们,则需要在此处使用内联 HTML。

* <p>a

<!-- -->

* <p>b

(在大多数实现中,您不需要在 markdown 中关闭

— 它们会被 markdown 自动关闭)

这是使用 stackoverflow 的 markdown 的第二个实时示例:

  • a< /p>

  • b

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文