A sample script for joint HTML/EPUB/DOCX/PDF production from a single Markdown source file using Pandoc. Created for The Future of the Book course in the University of Toronto Faculty of Information.
Open a terminal in the directory and run the command make
. For a list of available commands, run make help
.
Sustainable Authorship in Plain Text using Pandoc and Markdown is a general introduction to Pandoc. Creating an e-book with Pandoc explains the basics of EPUB generation.
For an introduction to Make, see Software Carpentry: Automation and Make.
-
Make:
- On the Mac, install Xcode from the App Store or run
xcode-select --install
in the Terminal. - On Windows, install Git for Windows (providing a version of Bash) and the Software Carpentry Windows Installer. Alternatively, on Windows 10, install the Windows Subsystem for Linux.
- On the Mac, install Xcode from the App Store or run
-
Pandoc: see Installing Pandoc.
-
If you need PDF production, install TeX Live or another LaTeX distribution (not enabled by default: to generate using Make, run
make pdf
). (Note that there are other methods of creating PDFs through Pandoc.)
You can most easily install Pandoc and LaTeX on the Mac by installing Homebrew, then pasting the following into the Terminal (be warned that MacTeX is a large installation):
brew install pandoc
brew tap caskroom/cask
brew cask install mactex
You can also generate e-books in Kindle format by combinining Pandoc with KindleGen. To install with Homebrew Cask, run brew cask install kindlegen
.