pip install python-md2docx
md2docx --help
md2docx tests/demo.md -o tests/demo-default.docx
md2docx tests/demo.md -o tests/demo-code-as-image.docx --code-as-image
md2docx tests/demo.md -o tests/demo-render-mermaid.docx --render-mermaid
md2docx tests/demo.md -o tests/demo-styles.docx --heading-color FF00FF --default-font Arial --chinese-font 微软雅黑
from md2docx.core import MD2DOCX
MD2DOCX().convert('tests/demo.md', output_file='tests/demo.docx')
MD2DOCX().convert(
'tests/demo.md',
output_file='tests/demo.docx',
heading_color='FF00FF',
default_font='Arial',
chinese_font='微软雅黑',
code_as_image=True,
)
Render Mermaid based on Mermaid Client(mmdc)
install it with: npm install -g @mermaid-js/mermaid-cli