Class: Middleman::CommonmarkerExtension

Inherits:
Extension
  • Object
show all
Defined in:
lib/middleman-commonmarker/extension.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, options_hash = {}, &block) ⇒ CommonmarkerExtension

Returns a new instance of CommonmarkerExtension.



12
13
14
15
16
# File 'lib/middleman-commonmarker/extension.rb', line 12

def initialize(app, options_hash = {}, &block)
  super
  require "commonmarker"
  require "middleman-commonmarker/commonmarker_template"
end

Instance Method Details

#after_configurationObject

Runs after core’s :markdown_renderer (before_configuration), so this Tilt.prefer overrides the default Kramdown engine. app.config is still writable here (it is not finalized, since core itself writes cli_options after after_configuration).



22
23
24
25
26
27
28
29
# File 'lib/middleman-commonmarker/extension.rb', line 22

def after_configuration
  unless options.options.empty?
    app.config[:markdown] = (app.config[:markdown] || {}).merge(options.options)
  end

  exts = %w[markdown mdown md mkd mkdn]
  ::Tilt.prefer(::Middleman::Renderers::CommonmarkerTemplate, *exts)
end