python 是否有允许从 markdown 转换为 html(包括列表)的库?

Is there a library for python that allows conversions from markdown to html (including lists)?

是否有 python 的库允许从 markdown 转换为 html(包括列表)?

我试过使用两个库:markdown 和 markdown2 这两个库都接受以下输入:

###Stepped
The translation will pause if:
- There are no translations for this word
- There are multiple translations for this word

And will ask you how to continue

并将其转换为:

<h3>Stepped</h3>

<p>The translation will pause if:
- There are no translations for this word
- There are multiple translations for this word</p>

<p>And will ask you how to continue</p>

我正在寻找类似于 https://markdowntohtml.com/

的功能

这是一个非常标准的功能。

问题可能出在您的输入上。在列表上方添加一个空行:

###Stepped
The translation will pause if:

- There are no translations for this word
- There are multiple translations for this word

And will ask you how to continue

我还建议在标题后添加一个空行,并 space 将哈希值与标题文本分开:

### Stepped

The translation will pause if:

- There are no translations for this word
- There are multiple translations for this word

And will ask you how to continue

这有助于源代码的可读性,它是 explicit design consideration:

The overriding design goal for Markdown’s formatting syntax is to make it as readable as possible. The idea is that a Markdown-formatted document should be publishable as-is, as plain text, without looking like it’s been marked up with tags or formatting instructions.

许多规范和实现中也需要 ###Stepped 之间的 space,including CommonMark,它正在迅速获得关注:

The opening sequence of # characters must be followed by spaces or tabs, or by the end of line.