Converting Markdown to PDF with Slidox

I've had this small project called Slidox laying around since August 2014. It was only yesterday when I noticed it and decided to spend few more hours to wrap it up and release it (backup the code on Github and Rubygems). Nothing fancy, just wiring up some simple Ruby tooling for converting Markdown to PDF with preference for syntax highlighting.

The background

A while back I changed my blog to a new build process of markup processing and code syntax highlighting based on Github's preference to building HTML from Markdown. So, I thought why not use the same tools and build PDF from the HTML with wkhtmltopdf. Then, I have Slidox, an automated tool for building simple presentations and even small books.

Dependencies and installation

Slidox has few system dependencies like libicu-dev, cmake and wkhtmltopdf (which is actually installed as a gem, wkhtmltopdf-binary).

Start by installing the system dependencies first:

sudo apt-get install libicu-dev
sudo apt-get install cmake

Then, install slidox gem:

gem install slidox


Create new slidox project called example:

slidox new example

Then cd into the new directory with cd example and you will see the project structure:

├── assets
│   ├── elephants.jpg
│   ├── jellybeans.css
│   ├── line_numbers.css
│   ├── main.css
│   └── OpenSans-Light-webfont.ttf
├── config.yml
└── slides

The assets directory contains basic styles to get you started. slides dir is where you add the slides to build. config.yml contains few configutation options for the PDF export from pdfkit and build targets for both HTML and PDF formats.

To build the project:

slidox build

Then, Slidox creates new build directory with HTML and PDF files inside. Here's the PDF preview:

Slidox PDF build screenshot

You can find more syntax highlighting themes and read this blog post for more info on the tools used.