Edit

convert markdown to word

Postach.io published

this is super easy with pandoc. The conversion back leaves the Markdown in pandoc’s format (not necessarily the formatting you used to write it in the first place) so this isn’t perfect for merging in changes from lay-users who cannot write in markdown. Human merging is required, however it does make it much easier to get all of the grammar checking one has become accustom to in word processors!

* cool aside, pandoc is written in haskell *

Steps

Install Pandoc

For mac users, you better be using homebrew!

brew install pandoc

Convert File

let’s say we have a file README.md that we want to share in Microsoft Word

pandoc -f markdown -t docx README.md -o README.docx

Read the above command as;
pandoc from (-f) markdown to (-t) docx, output (-o) as README.docx

you can also do the reverse and convert word to markdown with

pandoc -f docx -t markdown README.docx -o README.md

but be careful not to overwrite your original file!!!

Scripts

I’ve written some scripts that do the same thing - convert markdown files to docx.

Uh oh, it looks like your embed code is broken.

%23%20convert%20markdown%20to%20word%20%0A@%28Postach.io%29%5Bpublished%5D%0A%0A%0A%0Athis%20is%20super%20easy%20with%20%5Bpandoc%5D%28https%3A//pandoc.org/%29.%20The%20conversion%20back%20leaves%20the%20Markdown%20in%20pandoc%27s%20format%20%28not%20necessarily%20the%20formatting%20you%20used%20to%20write%20it%20in%20the%20first%20place%29%20so%20this%20isn%27t%20perfect%20for%20merging%20in%20changes%20from%20lay-users%20who%20cannot%20write%20in%20markdown.%20Human%20merging%20is%20required%2C%20however%20it%20does%20make%20it%20much%20easier%20to%20get%20all%20of%20the%20grammar%20checking%20one%20has%20become%20accustom%20to%20in%20word%20processors%21%0A%0A%20%20%5C*%20%20*cool%20aside%2C%20pandoc%20is%20written%20in%20%60haskell%60*%20%20*%0A%20%20%0A%20%20%0A%23%23%20Steps%20%0A%0A%23%23%23%20Install%20Pandoc%0AFor%20mac%20users%2C%20you%20better%20be%20using%20homebrew%21%20%0A%60%60%60bash%0Abrew%20install%20pandoc%0A%60%60%60%0A%0A%0A%23%23%23%20Convert%20File%20%0Alet%27s%20say%20we%20have%20a%20file%20%60README.md%60%20that%20we%20want%20to%20share%20in%20Microsoft%20Word%20%0A%20%20%0A%60%60%60bash%0Apandoc%20-f%20markdown%20-t%20docx%20README.md%20-o%20README.docx%0A%60%60%60%0ARead%20the%20above%20command%20as%3B%20%0Apandoc%20from%20%28%60-f%60%29%20markdown%20to%20%28%60-t%60%29%20docx%2C%20output%20%28%60-o%60%29%20as%20%60README.docx%60%0A%0A%0Ayou%20can%20also%20do%20the%20reverse%20and%20convert%20word%20to%20markdown%20with%20%0A%60%60%60bash%0Apandoc%20-f%20docx%20-t%20markdown%20README.docx%20-o%20README.md%0A%60%60%60%0A%0A%0Abut%20be%20careful%20not%20to%20overwrite%20your%20original%20file%21%21%21%20%0A%0A%0A%23%23%20Scripts%20%0AI%27ve%20written%20some%20scripts%20that%20do%20the%20same%20thing%20-%20convert%20markdown%20files%20to%20docx.%20%0A%0A%5Bgist%3D%22https%3A//gist.github.com/sblack4/b9c61515137797701373cd83c0f650c0.js%22%5D%0A%0A%0A