Thursday, January 17, 2008

Syntax Highlight 'Hello World' in Blogger

#I've been wanting syntax highlighting for my code samples for awhile
#But blogger doesn't give you anything special for doing it
#The references section at the bottom of this post has links to blogs
#that describe how to get highlighting for ruby, xml, and yaml. It is a start.

#Ruby code syntax highlight example
class Say
def self.hello
puts 'hello world'
end
end

Say.hello

#References:
#http://blog.wolfman.com/articles/2006/05/26/howto-format-ruby-code-for-blogs
#http://blog.michaelgreenly.com/2007/12/blog-post.html

2 comments:

Kamil Dworakowski said...

I have noticed from your previous post that your are using Vim. Vim can convert the code to html that looks exactly like what you see inside the editor. I don't know the command, I always use the menu item Syntax | Convert to html. This is actually the only single menu item I use in Vim.

Shlomo said...

Hey, thanks! I'll look into that.