Class: Malt::Engine::RDiscount

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

Overview

Discount Markdown implementation.

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?, 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 create_engine engine object.


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

def create_engine(params={})
  text = parameters(params, :text)

  flags = engine_options(params)

  cached(text, flags) do
    ::RDiscount.new(text, *flags)
  end
end

#render(params = {}) ⇒ Object

Convert Markdown text to HTML text.


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

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

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