How should I convert Markdown (or similar) to a Word Document?

74

25

Here's the deal:
In school I want to write my actual content in Markdown (using [Q10] or Notepad++) in school so that I can actually focus on writing without the ugliness of Word 2000 on my screen, but I have the problem of actually converting the Markdown into the final Word document so that I can set the line spacing, margins, cover page, etc.

How can I accomplish this?

I should also mention that I'm running said programs (except Word) off of my flash drive as PortableApps, the school computers run DeepFreeze, and I do have commandline access.

digitxp

Posted 2010-08-29T00:07:13.453

Reputation: 13 502

Note that the selected answer (as of today) is not the best answer. Pandoc v1.9 and higher supports directly converting Markdown into .docx, including proper use of headings (the outline works!) and embedded images. I just tried it and it works wonderfully. – technomalogical – 2013-09-30T16:06:07.487

Answers

86

Get pandoc version 1.9 or higher. Then:

pandoc myfile.txt -o myfile.docx

Recent versions of pandoc allow direct conversion of markdown to word.

John MacFarlane

Posted 2010-08-29T00:07:13.453

Reputation: 1 426

14

This isn't a complete answer to your situation, but you may want to investigate using Pandoc which can convert Markdown into other formats including RTF (which MS Word should be able to handle reasonably well).

Unfortunately, I have no idea if this will work with the DeepFreeze system you describe.

moberley

Posted 2010-08-29T00:07:13.453

Reputation: 418

It looks like I'm stuck with writing something myself based off of Pandoc :-( – digitxp – 2010-08-29T13:44:58.817

11

If you already have a Markdown tool for producing HTML, open the HTML in a browser and copy/paste into Word. Alternately, just open the HTML file itself in Word then save as Word format.

Doug Harris

Posted 2010-08-29T00:07:13.453

Reputation: 23 578

7

The method that has worked best for me is to use markdown to produce HTML, upload the document to Google Docs, select the option for Google Docs to convert it to their format, then download it as a DOC file.

Using pandoc to convert to RTF works (make sure to use --standalone option), but it loses the "style* of headers in Word.

Using Google Docs, the resulting DOC file keeps the notion of style so that you can change the formatting of all h1 headers in one step.

atlpeg

Posted 2010-08-29T00:07:13.453

Reputation: 81

2

There's a really handy how to for doing this on a Mac here. If you're using Notepad++ I imagine this won't apply to you, but it may help someone else :-D

danodonovan

Posted 2010-08-29T00:07:13.453

Reputation: 473

2

If you work on a Mac, iA Writer now does Word (.docx) to Markdown and Markdown to Word (.docx) conversion: iAWriter.com

Frank Westphal

Posted 2010-08-29T00:07:13.453

Reputation: 21

2

I like to use WriteMonkey, it's one of those distraction free text editors.

It exports from markdown to HTML or word. And it's portable. Requires .net though.

shuang

Posted 2010-08-29T00:07:13.453

Reputation: 21