擅长:python、mysql、java
<p>在本例中,Python Markdown的行为适用于John Gruber的原始代码(您可以在<a href="https://daringfireball.net/projects/markdown/dingus" rel="nofollow noreferrer">Markdown projects website</a>测试它)。也许您可以为Python Markdown编写一个扩展来更改行为</p>
<p>您还可以查看python-markdown2,它们有一个选项可以更改解析器的行为,以接受不带换行符的列表(拥抱列表):</p>
<pre><code>import markdown2
md_text = "**bold text**
* list item 1
* list item 2
* list item 3"
md = markdown2.markdown(md_text, extras=['cuddled-lists'])
print(md)
</code></pre>
<p>这将导致:</p>
<blockquote>
<p><strong>bold text</strong></p>
<ul>
<li>list item 1</li>
<li>list item 2</li>
<li>list item 3</li>
</ul>
</blockquote>