Class: Blogit::Parsers::MarkdownParser

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(content) ⇒ MarkdownParser

Returns a new instance of MarkdownParser.



9
10
11
# File 'lib/blogit/parsers/markdown_parser.rb', line 9

def initialize(content)
  @content = content
end

Instance Attribute Details

#contentObject (readonly)

A String containing the content to be parsed



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

def content
  @content
end

Instance Method Details

#parsedObject

The parsed content

Returns an HTML safe String



16
17
18
19
# File 'lib/blogit/parsers/markdown_parser.rb', line 16

def parsed
  ensure_pygments_is_installed if Blogit::configuration.highlight_code_syntax
  markdown.render(content).html_safe
end