参考:https://www.jianshu.com/p/0eff6cba1b7f

 

操作:

1、安装python支持包

pip install mkdocs       #  含markdown包

或者只安装markdown

pip install markdown

 

 2、代码

 1 from markdown.core import markdown
 2 
 3 if __name__ == '__main__':
 4     mdtext5 = """# Welcome to MkDocs
 5 
 6 For full documentation visit [mkdocs.org](https://www.mkdocs.org).
 7 
 8 ## Commands
 9 
10 * `mkdocs new [dir-name]` - Create a new project.
11 * `mkdocs serve` - Start the live-reloading docs server.
12 * `mkdocs build` - Build the documentation site.
13     
14 """
15     r = markdown(mdtext5, tab_length=4)
16     print(r)

 

3、输出:

markdown格式字串转html格式字串

 

相关文章:

  • 2021-11-14
  • 2022-02-08
  • 2022-01-29
  • 2021-11-27
  • 2021-11-27
  • 2021-06-16
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-06-21
  • 2021-11-11
  • 2021-10-22
  • 2021-11-05
  • 2022-03-10
相关资源
相似解决方案