Class: Malt::Engines::Kramdown

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

Overview

Discount Markdown implementation.

http://github.com/rtomayko/rdiscount

The :smart and :filter_html options can be set true to enable those flags on the underlying RDiscount object.

Instance Attribute Summary

Attributes inherited from Abstract

#settings

Instance Method Summary collapse

Methods inherited from Abstract

#cache?, #compile, default, #initialize, register

Constructor Details

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

Instance Method Details

#intermediate(params) ⇒ Object

Convert Markdown text to intermediate object.



30
31
32
33
# File 'lib/malt/engines/kramdown.rb', line 30

def intermediate(params)
  text = params[:text]
  ::Kramdown::Document.new(text)
end

#render(params) ⇒ Object

Convert Markdown text to HTML text.



16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/malt/engines/kramdown.rb', line 16

def render(params)
  text   = params[:text]
  format = params[:format]
  case format
  when :html, nil
    intermediate(params).to_html
  when :latex
    intermediate(params).to_latex
  else
    super(params)
  end
end