lib/middleman-syntax/extension.rb in middleman-syntax-1.0.1 vs lib/middleman-syntax/extension.rb in middleman-syntax-1.1.0

- old
+ new

@@ -1,11 +1,19 @@ module Middleman module Syntax class << self + + def options + @@options + end + def registered(app, options_hash={}) require 'pygments' + @@options = options_hash + yield @@options if block_given? + app.send :include, Helper require 'middleman-core/renderers/redcarpet' Middleman::Renderers::MiddlemanRedcarpetHTML.send :include, MarkdownCodeRenderer end @@ -41,16 +49,19 @@ ensure # Reset stored buffer @_out_buf = _buf_was end - concat_content Pygments.highlight(content, :lexer => language) + options = ::Middleman::Syntax.options.merge :lexer => language + concat_content Pygments.highlight(code, :options => options) end end module MarkdownCodeRenderer def block_code(code, language) - Pygments.highlight(code, :lexer => language) + options = ::Middleman::Syntax.options + options.merge :lexer => language if language + Pygments.highlight(code, :options => options) end end end end