Philipp Michalski

Software engineer – deeply passionate about coding, making, understanding and simplifying things

How to enable syntax higlighting for code snippets in Jekyll

As I started using Jekyll for this site it seemed obvious, that highlighting of code blocks in markdown is included in Jekyll out of the box. But when I started adding code to my markdown posts, no highlighting showed up. Well, when I inspected the output HTML the code fragments where annotated with the appropriate style classes but there were no styles. It was quite hard to find in their documentation that you have to add your own.

I figured out, that the highlighting styles where compatible to pygments and pygments highlighting themes should work well on the rouge-processed code.

There is also a bunch of great highlighting themes out there. I picked the GitHub one from this GitHub repo.

I might add some advanced styles later, e.g. the additional line numbers by look amazing.