Class: MarkdownToSimpleHtml::MarkdownParser
- Inherits:
-
Object
- Object
- MarkdownToSimpleHtml::MarkdownParser
- Defined in:
- lib/markdown_to_simple_html.rb
Instance Method Summary collapse
-
#initialize(filename) ⇒ MarkdownParser
constructor
A new instance of MarkdownParser.
- #to_html ⇒ Object
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_html ⇒ Object
12 13 14 |
# File 'lib/markdown_to_simple_html.rb', line 12 def to_html @parser.render(@contents) end |