Class: Malt::Engine::Kramdown

Inherits:
Abstract show all
Defined in:
lib/malt/engines/kramdown.rb

Overview

Kramdown Markdown implementation.

http://kramdown.rubyforge.org/

Instance Attribute Summary

Attributes inherited from Abstract

#settings

Instance Method Summary collapse

Methods inherited from Abstract

#cache?, default, #initialize, #prepare_engine, register, type

Constructor Details

This class inherits a constructor from Malt::Engine::Abstract

Instance Method Details

#create_engine(params = {}) ⇒ Object

Convert Markdown text to intermediate object.



41
42
43
44
45
46
# File 'lib/malt/engines/kramdown.rb', line 41

def create_engine(params={})
  text = parameters(params, :text)
  cached(text) do
    ::Kramdown::Document.new(text)
  end
end

#render(params = {}) ⇒ Object

Convert Markdown text to HTML text.

Parameters:

  • params (Hash) (defaults to: {})

    A hash containing the Markdown extensions which the parser will identify. The following extensions are accepted.

Options Hash (params):

  • :text (String)

    Template text.

  • :to (String, Symbol) — default: 'html'

    Type or file extension to convert template into.

See Also:



27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/malt/engines/kramdown.rb', line 27

def render(params={})
  into, text = parameters(params, :to, :text)

  case into
  when :html, nil
    prepare_engine(params).to_html
  when :latex
    prepare_engine(params).to_latex
  else
    super(params)
  end
end