Class: Forem::Formatters::RedcarpetGfm

Inherits:
Object
  • Object
show all
Defined in:
lib/forem/formatters/redcarpet_gfm.rb

Class Method Summary collapse

Class Method Details

.blockquote(text) ⇒ Object



14
15
16
17
18
# File 'lib/forem/formatters/redcarpet_gfm.rb', line 14

def self.blockquote(text)
  text.split("\n").map do |line|
    "> " + line
  end.join("\n")
end

.format(text) ⇒ Object



6
7
8
9
10
11
# File 'lib/forem/formatters/redcarpet_gfm.rb', line 6

def self.format(text)
  formatter = ::Redcarpet::Markdown.new(::Redcarpet::Render::HTML,
    :no_intra_emphasis => true, :fenced_code_blocks => true,
    :autolink => true, :lax_html_blocks => true)
  formatter.render(ERB::Util.h(text)).html_safe
end