Ask HN: How should I convert Microsoft Word documents to Markdown?

5 points by lkrubner 2 days ago

I took over a project that was built by an overseas team. They set up a data ingestion process. They have a step in the ingestion where they use Libre Office (in headless mode) to convert Microsoft Word documents to PDFs. Later we convert all PDFs to Markdown. They felt that it was best to convert everything to a PDF, and then convert all of the PDFs to Markdown.

What I notice is that LibreOffice can create very complex PDFs when the Microsoft Word document has:

1. tables

2. multiple columns

3. strikethrough text

I am thinking we should go straight from Microsoft Word to Markdown.

What is the right software for that?

mackatsol 2 days ago

Pandoc is awesome for this: `pandoc input.docx -o output.md` There's more you can do, with style sheets and so on, which you will likely have to dig into for the tables and multiple columns to come out the way you want. You can also extract media files from inside a docx file: `pandoc --extract-media=. input.docx -o output.md`

qup 2 days ago

I'd give an llm a shot before I ruled it out.

I had it generating .docx the other day and it did pretty well, so I assume it understands the format just fine.

And they're excellent at markdown.

kha1n3vol3 2 days ago

Start with pandoc before reinventing the wheel.

dhruvyads 2 days ago

Claude Code can do these types of really well unless you're trying to convert in bulk