Converting from AsciiDoc to MS Word

Short and sweet this one. I've written in the past how I love Markdown but I've actually moved on from that and now firmly throw my hat in the AsciiDoc ring. I'll write another post another time explaining why in more detail, but in short it's just more powerful whilst still simple and readable without compilation.

So anyway, I use AsciiDoc (ADOC) for all my technical (and often non-technical) writing now, and from there usually dump it out to HTML which I can share with people as needed:

asciidoctor --backend html5 -a data-uri my_input_file.adoc  

(-a data-uri embeds any images as part of the HTML file, for easier sharing)

But today I needed to generate a MS Word (DOCX) file, and found a neat combination of tools to do this:

asciidoctor --backend docbook --out-file - $INPUT_ADOC|pandoc --from docbook --to docx --output $INPUT_ADOC.docx  
# On the Mac, this will open the generated file in MS Word
open $INPUT_ADOC.docx  


Robin Moffatt

Read more posts by this author.

Yorkshire, UK