Class: Codnar::Sunlight

Inherits:
Object
  • Object
show all
Defined in:
lib/codnar/sunlight.rb

Overview

Syntax highlight using Sunlight.

Class Method Summary collapse

Class Method Details

.lines_to_html(lines, syntax) ⇒ Object

Convert a sequence of classified code lines to HTML using Sunlight syntax highlighting. All we need to do is wrap the lines in an HTML pre element with the correct class (sunlight-highlight-_syntax_). The actual highlighting is done in the HTML DOM using Javascript. Embedding this Javascript into the final HTML should be done separately.



11
12
13
# File 'lib/codnar/sunlight.rb', line 11

def self.lines_to_html(lines, syntax)
  return Formatter.lines_to_pre_html(lines, :class => "sunlight-highlight-#{syntax}")
end