Module: Codnar::CodeRay

Defined in:
lib/codnar/coderay.rb

Overview

Extend the CodeRay module.

Class Method Summary collapse

Class Method Details

.lines_to_html(lines, syntax, options = {}) ⇒ Object

Convert a sequence of classified code lines to HTML using CodeRay syntax highlighting. The options control the way CodeRay behaves (e.g., <tt>:css

> :class</tt>).



9
10
11
12
13
# File 'lib/codnar/coderay.rb', line 9

def self.lines_to_html(lines, syntax, options = {})
  return Formatter.merge_lines(lines, "html") do |payload|
    ::CodeRay.scan(payload, syntax).div(options).chomp
  end
end