Module: MdPreview::Parser

Extended by:
Parser
Included in:
Parser
Defined in:
lib/md_preview/parser.rb

Instance Method Summary collapse

Instance Method Details

#parse(content) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/md_preview/parser.rb', line 7

def parse(content)
  return if content.blank?

  return MdPreview::CustomParser.parse(content) if MdPreview.const_defined?(:CustomParser)

  markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML,
    :autolink            => true,
    :space_after_headers => true,
    :no_intra_emphasis   => true,
    :fenced_code_blocks  => true)

  markdown.render(content).html_safe
end