首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >是否有一个用于python的库,允许将标记转换为html (包括列表)?

是否有一个用于python的库,允许将标记转换为html (包括列表)?
EN

Stack Overflow用户
提问于 2022-03-24 18:16:22
回答 1查看 113关注 0票数 1

是否有一个用于python的库,允许将标记转换为html (包括列表)?

我尝试使用两个库: markdown和markdown2,这两个库都接受这个输入:

代码语言:javascript
复制
###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

并将其转换为:

代码语言:javascript
复制
<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/的功能

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2022-03-24 18:19:01

这是一个相当标准的特性。

问题很可能是你的意见。在列表的上方添加一个空行:

代码语言:javascript
复制
###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

我还建议在标题之后添加一个空行,并在标题文本之后添加一个分隔散列和标题文本的空格:

代码语言:javascript
复制
### 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

这有助于源代码的可读性,源代码是一个显式设计考虑

Markdown格式语法的重写设计目标是使其尽可能可读性。这样做的想法是,标记格式的文档应该以纯文本的形式发布,而不像用标记或格式说明进行标记。

###Stepped之间的空间在许多规范和实现( 包括CommonMark )中也是必需的,它正在迅速获得支持:

#字符的开头序列必须后面跟着空格或制表符,或行尾。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/71607550

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档