formatting code with jekyll 3 and bootstrap
29 November 2015
The release of Jekyll version 3 changed the default syntax highlighter from Pygments to Rouge. In a previous blog entry I described how I formatted code snippets for this blog which uses Jekyll version 2, Pygments and Bootstrap. That code does not work with the new version of Jekyll. This blog post will describe what I did to format code snippets when using Jekyll version 3 and Bootstrap version 3.
Jekyll now wraps code snippets in a figure
HTML tag. If linenumbers are used, a table is generated with the following (simplified) structure:
I did the following to format code blocks:
- Created a stylesheet for syntax hightlighting. I used the github syntax stylesheet
- Added the following to the stylesheet
The good news is, this code is much simpler than what I used for formatting the code snippets with Jekyll version 2 and Bootstrap! Unfortunately, it is not yet available with Github Pages. Hopefully, it will be soon!
You can see the full CSS file on Github: syntax.css
If you have any questions or suggestions on how I can improve this code, please let me know!