Class: Publishr::KramdownProcessor

Inherits:
Object
  • Object
show all
Defined in:
lib/publishr/kramdown_processor.rb

Class Method Summary collapse

Class Method Details

.convert(html, image_url_prefix) ⇒ Object



3
4
5
6
7
8
9
10
# File 'lib/publishr/kramdown_processor.rb', line 3

def self.convert(html,image_url_prefix)
  sanitized_html = HtmlProcessor.sanitize(html)
  kramdown = Kramdown::Document.new(sanitized_html, :input => 'html', :line_width => 100000 ).to_kramdown
  kramdown.gsub!(/\!\[(.*?)\]\((.*?)\)/){ "![#{$1}](#{image_url_prefix}#{$2})" }
  kramdown.gsub! '\"', '"'
  kramdown.gsub! "\\'", "'"
  return kramdown
end