Module: MarkdownHelper
- Included in:
- ActionView::Base
- Defined in:
- app/helpers/markdown_helper.rb
Instance Method Summary collapse
-
#markdown(text, options = nil) ⇒ Object
This method returns the given markdown code rendered as html.
Instance Method Details
#markdown(text, options = nil) ⇒ Object
This method returns the given markdown code rendered as html. Have a look at these sources:
* http://railscasts.com/episodes/272-markdown-with-redcarpet
* https://github.com/vmg/redcarpet
* http://daringfireball.net/projects/markdown/syntax
8 9 10 11 12 |
# File 'app/helpers/markdown_helper.rb', line 8 def markdown(text, = nil) = || {autolink: true, no_intraemphasis: true, fenced_code: true, gh_blockcode: true} = || {hard_wrap: true, filter_html: false} Redcarpet::Markdown.new(Redcarpet::Render::HTML.new(), ).render(text || "").html_safe end |