Sha256: 68bc55c2bc1b52043209445889cba12490b19df12ae8669bde4f868209e88125
Contents?: true
Size: 471 Bytes
Versions: 1
Compression:
Stored size: 471 Bytes
Contents
require 'liquid' require 'rouge' module Eyemask module Liquid module Highlight 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 end end end Liquid::Template.register_filter(Eyemask::Liquid::Highlight)
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
eyemask-0.1.0 | lib/eyemask/liquid/highlight.rb |