now with code higlighting
I am a programmer and I like to write code and I like to talk about code. That's why this blog really needs some syntax highlighting for my favorite languages.
With jekyll as my static site generator it is easy to enable it. Just get the kramdown library for markdown parsing and coderay for the highlighting. Then enable both in your configuration.
This is my current _config.yml:
paginate: 5 permalink: pretty exclude: Rakefile markdown: kramdown kramdown: use_coderay: true coderay: coderay_line_numbers: coderay_tab_width: 2 coderay_css: class
If you use coderay_css: class
make sure to include a CSS file on your page (see my coderay.css).
Adding syntax-highlighted code in your post now works like this:
indent code by 4 spaces even multi-line and define language after code block {:lang="ruby"}
{:lang="text"}
And now some real highlighting to show it in action:
module CodeRay def about [self.name.downcase, 'rocks!'].join(" ") end module_function :about end
And that's it.