来源:https://www.linode.com/docs/guides/how-to-use-python-markdown-to-convert-markdown-to-html/
1. 安装
pip install markdown -i https://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com
2. 使用
import markdown
markdown.markdown('## Work Tasks')
长文本
markdown.markdown('''
# To Do
## At Home
* Wash dishes
## At Work
* Finish Report
''')
3. 保留 #
使用 \#
可以避免 #
被解析为 h1
。
其它的特殊标签都可以通过加转义字符的方式避免被解析。