Mikael Asp Somkane's tech blog

This is where I write about programming, Linux and other fun tech stuff

About me Home :: Jekyll :: Vim :: Linux :: Personal :: Tag Cloud

Add line numbers in Jekyll code examples

Sometimes I want to refer to a certain line in a code example and decided to add line numbers. To get them just add the following lines to _config.yml.

1
2
3
4
kramdown:
  syntax_highlighter_opts:
    block:
      line_numbers: true

If you test it you will se that if you have more than one example in a page the left column will have different width depending on the width of the code on the right. I fixed that with a little bit of css that I explain in this blog post.