1
当尝试这个简单的降价转换为HTML:标记返回与嵌套列表列表项和段落错误的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>
段落第一级列表内部是嵌套列表的第二个列表项的一部分。
我希望这个段落是嵌套列表的兄弟,我甚至在不同的在线编辑器中测试它,并且它们按照我的预期呈现它,并且不喜欢marked
的结果。
我做错了什么或者是marked
的错误?
我试着玩的选项,但没有任何帮助。
下面的代码:
const marked = require("marked");
let str = "* section one\n\t* item one\n\t* item two\n\n\tThis is the first section";
str += "\n\n* section two\n\t* item one\n\t* item two\n\n\tThis is the second section";
marked(str)
谢谢。我打开了一个[新问题](https://github.com/chjj/marked/issues/789),让我们看看他们说了些什么。 –