class Malt::Engine::Kramdown

Kramdown Markdown implementation.

http://kramdown.rubyforge.org/

Constants

ENGINE_OPTION_NAMES

Kramdown has lots of options!

Public Instance Methods

create_engine(params={}) click to toggle source

Convert Markdown text to intermediate object.

# 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={}) click to toggle source

Convert Markdown text to HTML text.

@param [Hash] params

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

@option params [String] :text

Template text.

@option params [String,Symbol] :to ('html')

Type or file extension to convert template into.

@see kramdown.rubyforge.org/rdoc/Kramdown/Options.html

Calls superclass method Malt::Engine::Abstract#render
# 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

Private Instance Methods

engine_option_names() click to toggle source
# File lib/malt/engines/kramdown.rb, line 67
def engine_option_names
  ENGINE_OPTION_NAMES
end
require_engine() click to toggle source

Load rdoc makup library if not already loaded.

# File lib/malt/engines/kramdown.rb, line 51
def require_engine
  return if defined? ::Kramdown
  require_library 'kramdown'
end