02 May 2025
After struggling with other approaches using the markdown
and docx
libraries, this instead yields the best results:
import pypandoc
pypandoc.convert_file(md_path, 'docx', outputfile=docx_path, format='markdown+hard_line_breaks')
with installing first with either pip install pypandoc
or brew install pandoc
(preferred)