This blog is powered by Enki and as technical blog, I’d like to insert some code snippets to the entries. As a rails 3 application, integrating google-code-prettify is relatively simple.
First download the installation bundle (I experienced some difficulties, with perl, to make a distribution package from the svn):
$ curl --progress-bar -o prettify-1-Jun-2011.tar.bz2 \ http://google-code-prettify.googlecode.com/files/prettify-1-Jun-2011.tar.bz2
Now, copy the
.js and the
pretiffy.css to your rails application public folder:
You can use one of the other styles by using the corresponding
<%= stylesheet_link_tag 'prettify' %> and
head element of your
/path/to/my/railsapp/app/views/layouts/application.html.erb file. Add
onLoad="prettyPrint()" attribute to the
Test and enjoy the efficient syntax highlighting!