Module: Eyemask::Liquid::Highlight

Defined in:
lib/eyemask/liquid/highlight.rb

Instance Method Summary collapse

Instance Method Details

#highlight(input, lang) ⇒ Object



8
9
10
11
12
13
14
15
16
# File 'lib/eyemask/liquid/highlight.rb', line 8

def highlight(input, lang)
  formatter = Rouge::Formatters::HTML.new(inline_theme: "github")
  lexer = Rouge::Lexer.find(lang)
  unless lexer.nil?
    formatter.format(lexer.lex(input))
  else
    "<pre class=\"docstring\">#{input}</pre>"
  end
end