Class: Malt::Formats::Markdown

Inherits:
Abstract
  • Object
show all
Defined in:
lib/malt/formats/markdown.rb

Overview

If using the Kramdown engine, then Latex is also a supported output format.

Instance Attribute Summary

Attributes inherited from Abstract

#options

Instance Method Summary collapse

Methods inherited from Abstract

#default, engine, #engine, #extensions, extensions, #file, #parse_type_and_data, #refile, register, #render, #subtype, #text, #to, #to_s, #type

Instance Method Details

#htmlObject



15
16
17
# File 'lib/malt/formats/markdown.rb', line 15

def html
  render_engine.render(:text=>text, :file=>file, :format=>:html)
end

#latexObject



20
21
22
# File 'lib/malt/formats/markdown.rb', line 20

def latex
  render_engine.render(:text=>text, :file=>file, :format=>:latex)
end

#markdownObject Also known as: md



25
26
27
# File 'lib/malt/formats/markdown.rb', line 25

def markdown
  text
end

#to_htmlObject

Convert to HTML.



33
34
35
36
# File 'lib/malt/formats/markdown.rb', line 33

def to_html
  opts = options.merge(:text=>html, :file=>refile(:html), :type=>:html)
  HTML.new(opts)
end

#to_latexObject

Latex is only supported by the Kramdown engine.



39
40
41
42
# File 'lib/malt/formats/markdown.rb', line 39

def to_latex
  opts = options.merge(:text=>html, :file=>refile(:latex), :type=>:latex)
  Latex.new(opts)
end

#to_markdownObject Also known as: to_md



45
46
47
# File 'lib/malt/formats/markdown.rb', line 45

def to_markdown
  self
end