class Hylite::Rouge
Public Class Methods
available?()
click to toggle source
# File lib/hylite/hyliters.rb, line 26 def self.available? require 'rouge' true rescue LoadError false end
Public Instance Methods
call()
click to toggle source
# File lib/hylite/hyliters.rb, line 37 def call # From Fish, you can see all styles with: # for style in (rougify help style | tail -1 | tr -d ' ' | tr , \n); echo \n===== $style =====; rougify highlight -t $style -l ruby bin/hylite ; end theme = ::Rouge::Theme.find 'monokai' formatter = ::Rouge::Formatters::Terminal256.new theme lexer = ::Rouge::Lexer.find @lang tokens = lexer.lex @code formatter.format(tokens) end
type()
click to toggle source
# File lib/hylite/hyliters.rb, line 33 def type :rouge end