Category: General


Pelican Code Block CSS Classes

Pelican provides support for generating content from two markup languages - reStructuredText (the default) and Markdown (if installed). For the most part both markup languages generate similar output, except when using Pygments to generate code blocks with syntax highlighting.

Code blocks generated from reStructuredText will use the CSS class highlight to handle the syntax highlighting, while Markdown will use the codehilite class by default. This can cause problems when developing themes for Pelican users who may be using either reStructuredText or Markdown, or users who choose to generate content using both markup languages.

Fortunately you can customise how the Markdown processor generates its output using the MD_EXTENSIONS setting in the pelicanconf.py file. You can configure the Markdown processor to generate code blocks using the highlight CSS class by inserting the following entry in you pelicanconf.py file:

MD_EXTENSIONS = ['codehilite(css_class=highlight)']

More information about pelicanconf.py settings can be found in the Pelican documentation.

New Blog

I have finally set up my new blog after many months of thinking about doing it.

Ever since I first heard about using static site generators for blogs the idea appealed to me. By their nature the content of blogs do not need to be generated dynamically so using static html pages means a lower resource overhead than using something with a database backend. Another bonus is that I no longer have to worry about keeping on top of the upgrade/patch cycle to fix security issues that comes with using something like Wordpress.

I was mainly looking for a static site generator written in Python so that if I ever wanted to make any modifications, I would be working with a programming language I enjoy. The two main ones I came across that were actively being developed (with releases) were Nikola and Pelican. I eventually chose Pelican over Nikola because all of its dependencies were pure python libraries, making it easier to set up in a virtualenv.

I have also been meaning to have a play with Bootstrap for a very long time, so I took the opportunity to play around with it over the last few days and have come up with a simple Pelican theme called bootstrap-jerrykan. I am pretty happy with the result.

So, here is my new blog.