Easy Syntax Highlighting Helper

November 1st, 2008

sudo gem install uv

(read this if you're having trouble)

def highlight(options = {:format =>"ruby"}, &block)
  Uv.parse( yield, "xhtml", options[:format], false, "twilight")
end

Which gives you:

<% highlight do %>
    class Person < ActiveRecord::Base
    end
<% end %>

Here's the CSS for the 'twilight' theme.

Oh and I do realise the irony of posting code about syntax highlighting with no highlighting...

References:

Ultraviolet gem

1 Response to “Easy Syntax Highlighting Helper”

  1. Rechnung Says:

    Very usefull plugin! Thank you Steve!

Sorry, comments are closed for this article.