Module: Blogg::ApplicationHelper

Defined in:
app/helpers/blogg/application_helper.rb

Defined Under Namespace

Classes: HTML

Instance Method Summary collapse

Instance Method Details

#markdown(text) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
# File 'app/helpers/blogg/application_helper.rb', line 18

def markdown(text)
  renderer = HTML.new(hard_wrap: true, filter_html: true)
  options = {
    autolink: true,
    no_intra_emphasis: true,
    fenced_code_blocks: true,
    lax_html_blocks: true,
    strikethrough: true,
    superscript: true
  }
  Redcarpet::Markdown.new(renderer, options).render(text).html_safe
end