Class: Mado::Markdown

Inherits:
Object
  • Object
show all
Defined in:
lib/mado/markdown.rb

Defined Under Namespace

Classes: HTML

Class Method Summary collapse

Class Method Details

.convert_markdown(path) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/mado/markdown.rb', line 11

def self.convert_markdown(path)
  renderer_options = {
                      filter_html: true,
                      hard_wrap: true
                     }
  convert_options = {
                     autolink: true,
                     fenced_code_blocks: true,
                     lax_spacing: true,
                     no_intra_emphasis: true,
                     strikethrough: true,
                     superscript: true,
                     tables: true
                    }
  renderer = HTML.new(renderer_options)
  Redcarpet::Markdown.new(renderer, convert_options).render(open(path).read)
end