Syntax highlighting for Ruby and Rails

Highlight highlights code in more than 20 languages. It uses the Pygments syntax highlighter and adds a simple Ruby API over it. It also provides helpers for use in your Ruby on Rails views.


To highlight code e.g. in IRB, simply do:

require 'simplabs/highlight'
Simplabs::Highlight.highlight(:ruby, 'class Test; end')

or in your Rails views (caching is optional of course):

<% cache do %>
  <%= highlight(:ruby, 'class Test; end') -%>
<% end %>


Highlight is available as a gem:

gem install highlight

Get involved!

You can also fork Highlight on github (you might want to have a look at the RDoc then).

Copyright/ Acknowledgement

Highlight is developed by and © Marco Otte-Witte. It is released under the MIT License.