Sha256: ab76451de9fccf5c20ee33e0bb692ca6dac4bf2df6bc339da49690ef0d472fd2
Contents?: true
Size: 379 Bytes
Versions: 3
Compression:
Stored size: 379 Bytes
Contents
require 'redcarpet' class NoParagraphRenderer < ::Redcarpet::Render::XHTML def paragraph(text) text end end AutoHtml.add_filter(:image).with({:alt => ''}) do |text, options| r = Redcarpet::Markdown.new(NoParagraphRenderer) alt = options[:alt] text.gsub(/https?:\/\/.+\.(jpg|jpeg|bmp|gif|png)(\?\S+)?/i) do |match| r.render("![#{alt}](#{match})") end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
auto_html-1.5.1.1 | lib/auto_html/filters/image.rb |
auto_html-1.5.1 | lib/auto_html/filters/image.rb |
auto_html-1.5.0 | lib/auto_html/filters/image.rb |