lib/middleman-syntax/extension.rb in middleman-syntax-1.2.0 vs lib/middleman-syntax/extension.rb in middleman-syntax-1.2.1
- old
+ new
@@ -12,26 +12,22 @@
@@options = options_hash
yield @@options if block_given?
app.send :include, Helper
- if app.markdown_engine == :redcarpet
- begin
+ app.after_configuration do
+ if markdown_engine == :redcarpet
require 'middleman-core/renderers/redcarpet'
Middleman::Renderers::MiddlemanRedcarpetHTML.send :include, MarkdownCodeRenderer
- rescue LoadError
- end
- else
- begin
+ elsif markdown_engine == :kramdown
require 'kramdown'
Kramdown::Converter::Html.class_eval do
def convert_codeblock(el, indent)
attr = el.attr.dup
language = extract_code_language!(attr)
Middleman::Syntax::Highlighter.highlight(el.value, language)
end
end
- rescue LoadError
end
end
end
alias :included :registered
end