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

- (MarkdownParser) initialize(content)

Returns a new instance of MarkdownParser



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

def initialize(content)
  @content = content
end

Instance Attribute Details

- (Object) content (readonly)

A String containing the content to be parsed



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

def content
  @content
end

Instance Method Details

- (Object) parsed

The parsed content

Returns:

  • an HTML safe String



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

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