Using markdown to create any kind of document
A few weeks ago I had to submit the contents of a GitHub repository to my teacher for grading. I wanted to use my readme.md-file while my teacher asked for a Word or a PDF document. Then I discovered this amazing program which converts Markdown to any desirable format!
Almost every programmer knows Markdown, right? The Markdown syntax is widely used on GitHub and in readme-files. Markdown was developed by John Gruber and Aaron Swartz as a tool to convert plain text files in the syntactic language with the same name to HTML.
The complete Markdown syntax and more information is available on John Gruber’s website.
As you’ve seen / will see, writing texts with Markdown is pretty easy and structured. It’s quite easy to convert this text into another format than HTML. For that purpose, I’ve found pandoc. Pandoc packages are available for almost every operating system. I recommend adding it to your path if the installer didn’t do that automatically.
It’s quite simple to start using Pandoc. They have some great documentation available on their website and basically all you have to type is the following:
pandoc -o thefileyouwant.ext thefileyouhave.otherext
The output is very clean and structured and the list of supported formats is endless. This way you can write everything in Markdown and convert your text to the desired format afterwards. I hope you’ll enjoy using pandoc as much as I do!
In case you have any further questions, remarks or suggestions about this post, feel free to drop me a tweet or an email! You can also find me on Slack on the Xamarin Chat. I go by the username sam_d.
About the author
Sam is a C# developer who builds mobile (cross platform) apps with Xamarin. He's been a certified Xamarin mobile developer since 2016. Sam likes to experiment with all kinds of programming languages and software frameworks. More info