Class: Nanoc::Filters::ColorizeSyntax::Colorizers::PygmentsrbColorizer Private

Inherits:
Abstract
  • Object
show all
Defined in:
lib/nanoc/filters/colorize_syntax/colorizers.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Method Summary collapse

Methods inherited from Abstract

#postprocess

Instance Method Details

#process(code, language, params = {}) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



81
82
83
84
85
86
87
88
89
90
91
# File 'lib/nanoc/filters/colorize_syntax/colorizers.rb', line 81

def process(code, language, params = {})
  require 'pygments'

  args = params.dup
  args[:lexer] ||= language
  args[:options] ||= {}
  args[:options][:encoding] ||= 'utf-8'
  args[:options][:nowrap] ||= 'True'

  Pygments.highlight(code, args)
end