Module: Blusher

Defined in:
lib/blusher.rb,
lib/blusher/shim.rb,
lib/blusher/native.rb,
lib/blusher/version.rb

Overview

blusher — a fast, rouge-compatible syntax highlighter. Requiring it routes rouge’s lexers through the Rust ‘carmine` engine where it produces a byte-identical token stream, and falls back to rouge itself everywhere else (zero code change, zero divergence). See README.

Defined Under Namespace

Modules: Native, Shim

Constant Summary collapse

VERSION =
"0.1.0"

Class Method Summary collapse

Class Method Details

.lex(tag, source) ⇒ Object

Lex ‘source` with the lexer for `tag` (e.g. “ruby”), returning rouge

Token, value

pairs — via carmine when supported, else rouge.



14
15
16
17
# File 'lib/blusher.rb', line 14

def self.lex(tag, source)
  lexer = Rouge::Lexer.find(tag) or raise ArgumentError, "unknown lexer: #{tag}"
  lexer.new.lex(source).to_a
end