Sha256: f03fedd5832d0f756366ae600e5d8aaf2209ce08bdaba4d2313d6549543bd1c4
Contents?: true
Size: 938 Bytes
Versions: 4
Compression:
Stored size: 938 Bytes
Contents
# Encoding: utf-8 require "albino" require "redcarpet" module SlideEmUp class Markdown < Redcarpet::Render::HTML PARSER_OPTIONS = { :no_intra_emphasis => true, :tables => true, :fenced_code_blocks => true, :autolink => true, :strikethrough => true, :superscript => true } def self.render(text) text ||= "" markdown = Redcarpet::Markdown.new(self, PARSER_OPTIONS) markdown.render(text) end def block_code(code, lang) colorized = Albino.new(code, lang || "text").colorize(:P => "nowrap") "<pre><code class=\"#{lang}\">#{colorized}</code></pre>" end def strikethrough(text) "<s>#{text}</s>" end def normal_text(text) text.gsub!('« ', '« ') text.gsub!(/ ([:;»!?])/, ' \1') text.gsub!(' -- ', '—') text.gsub!('...', '…') text end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
slide-em-up-0.3.3 | lib/slide-em-up/markdown.rb |
slide-em-up-0.3.2 | lib/slide-em-up/markdown.rb |
slide-em-up-0.3.1 | lib/slide-em-up/markdown.rb |
slide-em-up-0.3.0 | lib/slide-em-up/markdown.rb |