Javascript 对于嵌套列表和段落的列表项,Marked返回错误的html

Javascript 对于嵌套列表和段落的列表项,Marked返回错误的html,javascript,markdown,javascript-marked,Javascript,Markdown,Javascript Marked,尝试将此简单标记转换为html时: * section one * item one * item two This is the first section * section two * item one * item two This is the second section 我收到的html是: <ul> <li> <p>section one</p>

尝试将此简单标记转换为html时:

* section one
    * item one
    * item two

    This is the first section

* section two
    * item one
    * item two

    This is the second section
我收到的html是:

<ul>
    <li>
        <p>section one</p>
        <ul>
            <li>item one</li>
            <li>
                <p>item two</p>
                <p>This is the first section</p>
            </li>
        </ul>
    </li>
    <li>
        <p>section two</p>
        <ul>
            <li>item one</li>
            <li>
                <p>item two</p>
                <p>This is the second section</p>
            </li>
        </ul>
    </li>
</ul>

这绝对是一个错误。正如您所注意到的,按预期渲染

但是,可以说您的文档中有一个小错误。您应该在(外部)列表项的第一行和嵌套列表之间添加一行

假设您正在创建一个只包含第一个(外部)列表项内容的文档。当您对列表进行格式化时,将如下所示:

section one
* item one
* item two

This is the first section
* section one

    * item one
    * item two

    This is the first section

* section two

    * item one
    * item two

    This is the second section
以下哪种降价实施最多:

<p>section one * item one * item two</p>
<p>This is the first section</p>
其一致性为:

你会得到很好的一致性:

嗯,事实证明马克也错了。肯定是个bug。

谢谢。我打开了一个,让我们看看他们怎么说。
<p>section one <em> item one </em> item two</p>
<p>This is the first section</p>
section one

* item one
* item two

This is the first section
<p>section one</p>
<ul>
    <li>item one</li>
    <li>item two</li>
</ul>
<p>This is the first section</p>
* section one

    * item one
    * item two

    This is the first section

* section two

    * item one
    * item two

    This is the second section