Class: Texter::MarkdownFormatter
- Defined in:
- app/lib/texter/markdown_formatter.rb
Instance Attribute Summary
Attributes inherited from Formatter
Instance Method Summary collapse
- #block ⇒ Object
-
#inline ⇒ Object
extracts html from the first paragraph or header.
Methods inherited from Formatter
Constructor Details
This class inherits a constructor from Texter::Formatter
Instance Method Details
#block ⇒ Object
24 25 26 27 28 29 |
# File 'app/lib/texter/markdown_formatter.rb', line 24 def block return nil if body.blank? markdown = ::RDiscount.new(body, *[:extensions]) markdown.to_html end |
#inline ⇒ Object
extracts html from the first paragraph or header
20 21 22 |
# File 'app/lib/texter/markdown_formatter.rb', line 20 def inline block.match(%r{<[hp]\d?>(.*?)</[hp]\d?>}).try(:[], 1) end |