Showing posts with label Blogger. Show all posts
Showing posts with label Blogger. Show all posts

Dec 24, 2007

Ruby Syntax Highlighting On Blogger

It turns out that creating syntax highlighted source in blogger is not difficult even if it's not convenient

The first step is to find an application that can syntax highlight and convert your code to HTML. I choose to hack together a quick little script on top of the Syntax library (the code's below)
require 'rubygems'
require 'syntax/convertors/html'
convertor = Syntax::Convertors::HTML.for_syntax "ruby"
puts convertor.convert(File.read(ARGV[0]))
Now when ever you want to make a post just choose 'Edit Html' in the composer and insert the output from your formatter application.

Depending on on your formatter you may need to add it's CSS to your Blogger template.

Dec 23, 2007

Sharing Code...

Edit: I've since changed my mind about this. See this post.

I was spending time refactoring some of the crufty code in KanbanOnRails and got stuck thinking about the best way for me to share code? Clearly Blogger is not it!

I think for the time being I'll just use a snippet service like http://snippets.dzone.com/