less than 1 minute read

This article describes how to configure Rouge to handle formatting of Highlights.

this is top image

Install

Ensure rouge is installed. Need 1.5 or later. Check Gemfile.lock, it should already be there.

Use Rouge

_config.yml

1
2
3
4
5
markdown: kramdown
highlighter: rouge

kramdown:
  syntax_highlighter: rouge

###Line Numbers

1
2
3
4
5
6
7
8
9
markdown: kramdown
highlighter: rouge

kramdown:
  syntax_highlighter: rouge
  syntax_highlighter_opts:
    block:
      line_numbers: true
      start_line: 1

Set Tab Size

The default tab size for a browser is 8 spaces. This will not do.

To change this to 2 spaces, add to css

1
2
3
4
pre {
	tab-size: 2;
	-moz-tab-size: 2;
}

I am using Sass and so I add to all.scss

References

Leave a Comment

Your email address will not be published. Required fields are marked *

Loading...