Pygmentize Example

Pygmentize is a fantastic gem for syntax highlighting. It's super easy to get going, even on Heroku! If you're using Heroku, be sure you use the Cedar Stack.

The source for this little is below. Very meta, I know. See the full project on GitHub. This fun example is brought to you by Sam Soffes.

Sinatra App

get '/' do
  @gemfile = Pygmentize.process('Gemfile', 'r').read, :ruby)
  @source = Pygmentize.process(, 'r').read, :ruby)
  @config = Pygmentize.process('', 'r').read, :ruby)
  erb :index


source ''

gem 'sinatra'
gem 'pygmentize'

require 'rubygems'
require 'bundler'

require './main'
run Sinatra::Application