Class: Blogit::Parsers::MarkdownParser

Inherits:
Object
  • Object
show all
Defined in:
lib/blogit/parsers/markdown_parser.rb

Instance Method Summary (collapse)

Constructor Details

- (MarkdownParser) initialize(content)

A new instance of MarkdownParser



7
8
9
# File 'lib/blogit/parsers/markdown_parser.rb', line 7

def initialize(content)
  @content = content
end

Instance Method Details

- (Object) parsed



11
12
13
14
15
# File 'lib/blogit/parsers/markdown_parser.rb', line 11

def parsed
  renderer = Blogit::configuration.highlight_code_syntax ?  Redcarpet::Render::HTMLWithAlbino : Redcarpet::Render::HTML
  markdown = Redcarpet::Markdown.new(renderer, Blogit.configuration.redcarpet_options)
  html_content = markdown.render(@content).html_safe
end