lib/retter/markdown.rb in retter-0.2.3 vs lib/retter/markdown.rb in retter-0.2.4

- old
+ new

@@ -1,28 +1,12 @@ # coding: utf-8 require 'redcarpet' -require 'pygments' -require 'coderay' -require 'set' module Retter module Markdown - class CodeRayRenderer < Redcarpet::Render::HTML - def block_code(code, lang) - CodeRay.scan(code, lang ? lang.intern : :plain).div - end - end - - class PygmentsRenderer < Redcarpet::Render::HTML - LANGUAGES = Set.new(Pygments.lexers.map {|_, l| l[:aliases] }.flatten) - - def block_code(code, lang) - lang = LANGUAGES.include?(lang) ? lang : 'text' - - Pygments.highlight(code, lexer: lang, formatter: 'html', options: {encoding: 'utf-8'}) - end - end + autoload :CodeRayRenderer, 'retter/markdown/code_ray_renderer' + autoload :PygmentsRenderer, 'retter/markdown/pygments_renderer' extend Configurable configurable :renderer