Jekyll: Failed to build gem native extension

When trying to install jekyll, I got the following error: mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h

$ sudo gem install jekyll
Fetching: liquid-2.6.2.gem (100%)
Successfully installed liquid-2.6.2
Fetching: kramdown-1.6.0.gem (100%)
Successfully installed kramdown-1.6.0
Fetching: mercenary-0.3.5.gem (100%)
Successfully installed mercenary-0.3.5
Fetching: safe_yaml-1.0.4.gem (100%)
Successfully installed safe_yaml-1.0.4
Fetching: colorator-0.1.gem (100%)
Successfully installed colorator-0.1
Fetching: posix-spawn-0.3.10.gem (100%)
Building native extensions.  This could take a while...
ERROR:  Error installing jekyll:
    ERROR: Failed to build gem native extension.

    /usr/bin/ruby2.1 extconf.rb
mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h

It turns out that I was missing the ruby development packages:

$ sudo apt-get install ruby-dev

Once I’d installed this, Jekyll installed fine.

Read More

Adding automatic code highlighting to your blog

One of the things I really liked about wp-svbtle is that it would automatically highlight any code samples I added. When I changed to Sparkling, the highlighting stopped.

Thankfully, it was an easy fix. To re-enable it, I added the following to my footer.php file in the theme:

<script>
jQuery("pre code").addClass("prettyprint");
</script>
<script src="https://google-code-prettify.googlecode.com/svn/loader/run_prettify.js"></script>

This enables all code blocks to be pretty printed, then includes Google’s pretty printer library. As you can see, it works like a dream.

Read More