Using Pelican to blog with IJulia notebooks (or other languages)

To publish this blog, I've been using the Pelican static blogging package. And because working in the IPython notebook is such a great experience for scientific computing, the liquid_tags Pelican plugin by Jake Vanderplas has been indispensable. (Jake has a really interesting blog, too.)

Using the plugin, you can do all of your work in a notebook — writing the content in Markdown, using LaTeX for equations, and writing code in code cells — and then turn the whole thing (highlighting and all) into a blog post.

For the last post, I decided to solve a math puzzle in Julia. Thanks to the IJulia project, it's possible to program Julia in an IJulia notebook just like you would with Python in an IPython notebook. In fact, the IPython project has recently spun off the completely language-agnostic Project Jupyter, which aims to make the IPython notebook experience available for any language. (Support already exists or is under active development for Ruby, Julia, Haskell, and R.)

The one roadblock with my current set-up in doing the last post was that liquid_tags didn't know how to highlight notebooks in languages other than Python. Because the Pygments library is used for syntax highlighting, all of the necessary machinery was in place to highlight almost any language — it just hadn't been hooked up yet within the notebook plugin.

To make that work, I shot a quick pull request to the pelican-plugins repo. (Thanks to Jake and Justin Mayer, the code was reviewed and merged within a few hours!)

The change allows you to specify a language argument when embedding a notebook:

{% notebook filename.ipynb language[julia] %}

Hopefully, other people will find this helpful, especially as Project Jupyter continues to add support for more and more languages.

Any comments or suggestions? Let me know.