Class: MarkdownToSimpleHtml::MarkdownParser

Inherits:
Object
  • Object
show all
Defined in:
lib/markdown_to_simple_html.rb

Instance Method Summary collapse

Constructor Details

#initialize(filename) ⇒ MarkdownParser

Returns a new instance of MarkdownParser.



7
8
9
10
# File 'lib/markdown_to_simple_html.rb', line 7

def initialize(filename)
	@contents = IO.readlines("#{filename}.md").join
	@parser = Redcarpet::Markdown.new(Redcarpet::Render::HTML, :autolink => true, :hard_wrap => true)
end

Instance Method Details

#to_htmlObject



12
13
14
# File 'lib/markdown_to_simple_html.rb', line 12

def to_html
	@parser.render(@contents)
end