Google Prettify

Google Prettify is implemented via the widgets API. Have a look at the widgets documentation if you haven't already.


Syntax highlighting is enabled by default using Google Prettify. Content specified in <pre></pre> blocks will be automatically highlighted. Prettify tries to automatically detect the language and highlight the syntax appropriately.

  • config.yml
widgets :
  google_prettify :
    use : default
    linenums : true

Choose a Provider

The widget specifies different snippets for the different engines. Set use to the provider you intend to use. Make sure to specify your account credentials for the relevant provider.

In the example above, the default provider will be used and will be provided with true as for the setting linenums.


Global Disable

Set enable: false to disable analytics globally.

# config.yml

widgets :
  google_prettify :
    enable : false

Per-Page Disable

Disable analytics for individual pages by specifying widgets.google_prettify.enable: false in the page YAML meta-data:

layout: post
categories : lessons
tags : [yay]
widgets :
  google_prettify :
    enable : false

Internally, the value of "enable" will be cast to a String. So you must specify exactly the value false or "false" for this to work.


Ruhoh's default "twitter" theme comes with all four of Google Prettify's user-submitted themes as well as the code-highlighting theme packaged with Twitter Bootstrap

The stylesheet is loaded as any other stylesheet would be:

<!DOCTYPE html>
<html lang="en">
  <meta charset="utf-8">
  <title>{{ page.title }} | ruhoh universal static blog generator</title>
  {{# stylesheets.load }}
  {{/ stylesheets.load }}


You can edit an existing stylesheet or create your own, just remember to update the stylesheet link.