Module: MarkDon::RequestHandler
- Defined in:
- lib/mark_don/request_handler.rb
Instance Method Summary collapse
Instance Method Details
#mark_don_handle_markdown_request(&action) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/mark_don/request_handler.rb', line 5 def mark_don_handle_markdown_request(&action) if MarkDon::MARKDOWN_FORMAT_SYMBOLS.include?(request.format.symbol) request.format = :html action.call if performed? && response.successful? html = Array(response_body).join markdown = MarkDon::Converter.convert(html) self.response_body = markdown response.content_type = 'text/markdown' end else action.call end end |