railslife-highliter is a very simple and lightweight sintax highlighter for ruby.
This script requires the syntax gem.
(sudo) gem install syntax
Very simple:
ruby railslife-highliter.rb /path/to/your/ruby/code.rb
Let’s say you have a code.rb file with this content:
class Hello
def say_hi
puts "hi, railslife-highlighter"
end
end
You run:
ruby railslife-highliter.rb code.rb
The result output you’ll get:
<pre><span class="keyword">class </span><span class="class">Hello</span>
<span class="keyword">def </span><span class="method">say_hi</span>
<span class="ident">puts</span> <span class="punct">"</span>
<span class="string">hi, railslife-highlighter</span><span class="punct">"</span>
<span class="keyword">end</span>
<span class="keyword">end</span>
That’s all for now.