MD代码

  1. ## IoCs
  2. ### FileHash
  3. 13871a0ca072473e646f147c11c054ea
  4. c37933ec8c2e986c78d70e1b5b5ec642
  5. f5f147661da458e39d413ef9b62c7d3c
  6. 18363437744197efdfb779bad31b32ca
  7. 052d9d237c35b7cc1a0e4e76cadf3664
  8. 578d9f0ced02ee2f03ad3484628671d7
  9. ### IP
  10. 142.202.191.236
  11. 142.202.191.234

Python代码

  1. # encoding = utf-8
  2. import markdown
  3. fileMarkDown = r'MarkDown.md'
  4. fileTest = r'test.md'
  5. fileHTML = r'HTML.html'
  6. def MD2HTML(fileMarkDown):
  7. with open(fileMarkDown, 'r', encoding='utf-8') as f:
  8. text = f.read()
  9. print(text)
  10. html = markdown.markdown(text)
  11. # print(html)
  12. with open(fileHTML, 'w', encoding='utf-8') as f:
  13. f.write(html)
  14. if __name__ == '__main__':
  15. MD2HTML(fileMarkDown)
  16. print("执行完毕")

HTML代码

  1. <h2>IoCs</h2>
  2. <h3>FileHash</h3>
  3. <p>13871a0ca072473e646f147c11c054ea
  4. c37933ec8c2e986c78d70e1b5b5ec642
  5. f5f147661da458e39d413ef9b62c7d3c
  6. 18363437744197efdfb779bad31b32ca
  7. 052d9d237c35b7cc1a0e4e76cadf3664
  8. 578d9f0ced02ee2f03ad3484628671d7</p>
  9. <h3>IP</h3>
  10. <p>142.202.191.236
  11. 142.202.191.234</p>

😑不满意😑

image.png

原因

导出的MarkDown没有保留换行
image.png

语雀换行

换行

image.png

未换行

image.png