Class: Middleman::Renderers::KramdownTemplate

Inherits:
Tilt::KramdownTemplate
  • Object
show all
Defined in:
lib/middleman-core/renderers/kramdown.rb

Overview

Our own Kramdown Tilt template that simply uses our custom renderer.

Instance Method Summary collapse

Constructor Details

#initialize(*args, &block) ⇒ KramdownTemplate

Returns a new instance of KramdownTemplate



7
8
9
10
11
# File 'lib/middleman-core/renderers/kramdown.rb', line 7

def initialize(*args, &block)
  super

  @context = @options[:context] if @options.key?(:context)
end

Instance Method Details

#evaluate(context) ⇒ Object



13
14
15
16
17
18
19
20
21
# File 'lib/middleman-core/renderers/kramdown.rb', line 13

def evaluate(context, *)
  MiddlemanKramdownHTML.scope = @context || context

  @output ||= begin
    output, warnings = MiddlemanKramdownHTML.convert(@engine.root, @engine.options)
    @engine.warnings.concat(warnings)
    output
  end
end