module Eyemask::Liquid::Highlight

Public Instance Methods

highlight(input, lang) click to toggle source
# 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