Color syntax for ruby code in Typo


Do you know how get color syntax for Ruby code snippets in Typo? It is
possible, but I do not know how:

Is it possible for Typo to get color syntax for other languages,
Python, PHP, etc?



It’s so easy to do color syntax formatting with the syntax gem. I
recently added this feature to the app on working on so here’s my 4

  1. install the gem…

gem install syntax

  1. Add the following require statements to the environment.rb file of
    your Rails app:

require ‘syntax’
require ‘syntax/convertors/html’

  1. Write yourself a helper method that does the conversion and
    conveniently wraps the resulting html in a div, for example…

def ruby_to_html(script_str)
convertor = Syntax::Convertors::HTML.for_syntax(‘ruby’)
return %(

  1. Include a copy of ruby syntax css file in your application, for

Hope it helps,


It’s even easier than that in Typo. I’m running 2.5.5, and this is what

<typo:code lang=“ruby”>

If you click on the ‘filters’ tab in the admin pages, you’ll see what
filters you’ve got installed. Also, the theme CSS needs to have the
entries for the typocode classes - the built in azure theme does, the
theme does not.