Class: Vita::Format::Markdown

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/vita/format/markdown.rb

Instance Method Summary collapse

Constructor Details

#initializeMarkdown

Returns a new instance of Markdown.



8
9
10
11
12
13
14
15
16
# File 'lib/vita/format/markdown.rb', line 8

def initialize
  @markdown = Redcarpet::Markdown.new(
    Redcarpet::Render::HTML,
    fenced_code_blocks: true,
    highlight: true,
    space_after_headers: true,
    strikethrough: true
  )
end

Instance Method Details

#nameObject



18
19
20
# File 'lib/vita/format/markdown.rb', line 18

def name
  "markdown"
end

#to_html(source) ⇒ Object



22
23
24
# File 'lib/vita/format/markdown.rb', line 22

def to_html(source)
  @markdown.render(source)
end