Class: RailsBlogEngine::Filters::Code

Inherits:
Base
  • Object
show all
Defined in:
lib/rails_blog_engine/filters/code.rb

Overview

Syntax highlighting for code blocks.

Instance Method Summary collapse

Methods inherited from Base

register_filter

Instance Method Details

#process(text, options) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/rails_blog_engine/filters/code.rb', line 13

def process(text, options)
  if defined?(Pygments)
    Pygments.new(text, options[:lang] || 'ruby').colorize
  else
    raise "Install pygments-gem to enable syntax highlighting"
  end
end