Apr 19, 2010

Ruby Syntax Gem

I've been using a gem called syntax to transform Ruby code into something that looks nice in HTML. It is quite easy to install:
sudo gem install syntax
And easy to use:
require 'rubygems'
require 'syntax/convertors/html'

convertor = Syntax::Convertors::HTML.for_syntax "ruby"
html = convertor.convert(File.read(ARGV[0]))
By default it supports Ruby, XML and YAML, and there might be a bunch of other ones out there on the Internet somewhere.

Speaking of syntax, I'm wondering if anybody knows of a good colour scheme for Gvim. I've been using one called pablo that comes with it for a while since it is pretty much the only dark theme that they have that doesn't make my eyes bleed, but it still isn't amazing. Does anybody know of one that looks really good that they are willing to share?

6 comments:

webmat said...

Hey Rob, the vim color scheme I use is Vibrant Ink by Tim Pope. I love it, check it out:

http://www.vim.org/scripts/script.php?script_id=1891

webmat said...

Or rather, it's based on Textmate's Vibrant Ink.

Rob Britton said...

Nice, it looks good. I'll try it out for a while.

Unknown said...

Here's two good vim colorschemes:

Molokai:
http://winterdom.com/2008/08/molokaiforvim

and Inkpot:
http://www.vim.org/scripts/script.php?script_id=1143

Unknown said...

I use the railscasts colorscheme:
http://www.vim.org/scripts/script.php?script_id=2175

Rob Britton said...

Alright, I like it! I will be playing with some of these a little bit I think.

I don't know why all the ones that come with Vim make me cringe, but you'd think after it being out for so long somebody would have done something about it!