Forum: Ruby on Rails Color syntax for ruby code in Typo

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
5f9c010866ed7b4ceff994510de2ef8c?d=identicon&s=25 hipertracker (Guest)
on 2005-11-13 23:02
(Received via mailing list)
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?

D61a2db96e73acf66b0b18688a39ecfb?d=identicon&s=25 obiefernandez (Guest)
on 2005-11-14 01:26
(Received via mailing list)
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

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

require 'syntax'
require 'syntax/convertors/html'

3) 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 %(<div class="ruby">#{convertor.convert(script_str)}</div>)

4)  Include a copy of ruby syntax css file in your application, for

Hope it helps,
3f900b38ec3b2c45427c354722fa4ce3?d=identicon&s=25 tom (Guest)
on 2005-11-14 04:12
(Received via mailing list)
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.
This topic is locked and can not be replied to.