Class: ReadmeScore::Document::Parser

Inherits:
Object
  • Object
show all
Defined in:
lib/readme-score/document/parser.rb

Instance Method Summary collapse

Constructor Details

#initialize(markdown) ⇒ Parser

Returns a new instance of Parser.



4
5
6
# File 'lib/readme-score/document/parser.rb', line 4

def initialize(markdown)
  @markdown = markdown
end

Instance Method Details

#parserObject



12
13
14
15
16
17
18
19
20
21
# File 'lib/readme-score/document/parser.rb', line 12

def parser
  @@parser ||= Redcarpet::Markdown.new(
    Redcarpet::Render::HTML,
    no_intra_emphasis: true,
    autolink: true,
    fenced_code_blocks: true,
    tables: true,
    strikethrough: true
  )
end

#to_htmlObject



8
9
10
# File 'lib/readme-score/document/parser.rb', line 8

def to_html
  parser.render(@markdown)
end