I’m gradually moving away from reStructuredText (RST) and I use more MarkDown(MD) to write generic documentation. In fact, I found myself using md files more and more and I really like the approach of focusing on content and let the tool generate a well formatted document according to the type needed.
Pandoc is a universal document converter and from an MD file can generate multiple output format. It’s open-source and really simple to use.
With “Content-First” approach in mind I’ve decided to write a simple tool to automate the generation of multiple output format starting from a single markdown.
I wrote a batch file that I’ve linked on my desktop, whenever I need to export a MD in different format I just drag the markdown file over the batch script icon and it creates all the desired format.
:: MD CONVERT
:: Converts all MarkDowns files passed as arguments into different
:: formats and saves them into a separate folder.
:: AUTHOR: Paolo Frigo, email@example.com
:: pandoc (https://pandoc.org/)
:: miktex for pdf conversion form LaTeX (https://miktex.org/)
set list=docx html rst odt rtf epub pdf
for %%x in (%*) do (
for %%e in (%list%) do (
pandoc %%x -o output/_%%e/%%~nx.%%e
pandoc %%x -o output/%%~nx/%%~nx.%%e
:: Keep a copy of the MarkDown File.
copy %%x output\_md\
copy %%x output\%%~nx\
This script is also available on github. I really hope you’ll find it useful. I’ll soon release a similar script in BaSH in case you’re using Mac or Linux.