How to convert from Word to Markdown with Front Matter with pandoc

1.5k Views Asked by At

I want to convert a Word document to Markdown, so I can use the result with Jekyll.

This works partially:

pandoc "in.docx" -f docx -t markdown -o "out.md"

However, pandoc doesn't generate a (YAML) Front Matter block, and I can't find a command line option to do this. Is this possible at all, or is it only available for Latex or other formats?

1

There are 1 best solutions below

1
On

In principle, the --standalone/-s flag should generate the YAML frontmatter. However, docx documents often don't contain machine readable metadata, and pandoc only tries to extract some basic data from the main text -- with varying success. So it's possible that there will no YAML block even when pandoc is called with -s.