class SlideEmUp::Markdown

Constants

PARSER_OPTIONS

Public Class Methods

render(text) click to toggle source
# File lib/slide-em-up/markdown.rb, line 17
def self.render(text)
  text ||= ""
  markdown = Redcarpet::Markdown.new(self, PARSER_OPTIONS)
  markdown.render(text)
end

Public Instance Methods

block_code(code, lang) click to toggle source
# File lib/slide-em-up/markdown.rb, line 23
def block_code(code, lang)
  colorized = Pygments.highlight(code, :lexer => lang || "text", :options => {:nowrap => true})
  "<pre><code class=\"#{lang}\">#{colorized}</code></pre>"
end
normal_text(text) click to toggle source
# File lib/slide-em-up/markdown.rb, line 32
def normal_text(text)
  text.gsub!('« ', '«&nbsp;')
  text.gsub!(/ ([:;»!?])/, '&nbsp;\1')
  text.gsub!(' -- ', '—')
  text.gsub!('...', '…')
  text
end
strikethrough(text) click to toggle source
# File lib/slide-em-up/markdown.rb, line 28
def strikethrough(text)
  "<s>#{text}</s>"
end