Wednesday, March 19, 2008

Pretty code snippets for the masses

In my last blog entry I pointed out a tool called Coderay for generating syntax-highlighted html for blog posts. Two train rides later and I've launched an application that should make life a whole lot easier for folks who want pretty code on their blog.

I give you Spotlight:

http://spotlight.heroku.com/


In other news, heroku is awesome.

Monday, March 17, 2008

I can stop whining about syntax highlighting for my blog

I've been googling off and on in what turned out to be a rather futile attempt at figuring out how to get the cute syntax highlighting you see on a lot of the major rails blogs working. Via The Rails Way I discovered the feature was apparently related to Mephisto, for which I promptly downloaded the source.

A few minutes later I found what I was looking for:

http://rubyforge.org/projects/coderay/

Debugging ERB Rendering In Rails

I had a helluva time figuring out that attempting to output a scriptlet that begins a block segment causes ERB to generate bad ruby code. Here's an example:
1 <%= tag_with_body do %><%end%>

What I really needed was a way to dump the generated ruby code from ERB. Turns out you can. On the last line of my controller action I added the following:
1 puts @__erbout