module SchnitzelPress class MarkdownRenderer < Redcarpet::Render::HTML include Redcarpet::Render::SmartyPants def block_code(code, language) CodeRay.highlight(code, language) end def image(link, title, alt_text) oembed = OEmbed::Providers.get(link) %q(
) % [oembed.type, oembed.html] rescue OEmbed::NotFound %q() % [link, escape_html(title), escape_html(alt_text)] end def escape_html(html) Rack::Utils.escape_html(html) end end end