Either you’ve already heard of pandoc or if you have searched online for markdown to pdf or similar, you are sure to come across pandoc. This tutorial will give you a basic idea of using pandoc to generate pdf from GitHub style markdown file. The main purpose is to highlight what customizations I did to generate pdf for self-publishing my ebooks. It wasn’t easy to arrive at the set-up I ended up with, so I hope this will be useful for those looking to use pandoc to generate pdf. Specifically aimed at technical books that has code snippets.
- Copy contents of raw .md file, having embedded links to images
- Modify image links in file with following (in Sublime Text 2):
- Find Regex: https://github.com/(.*)/blob/(.*)
- Replace: https://raw.githubusercontent.com/$1/$2
- Paste and 'Convert to HTML page'
- Use browser print to save as PDF