Class: Jekyll::SFMarkdownConverter

Inherits:
Converter
  • Object
show all
Defined in:
lib/jekyll-img-converter.rb

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ SFMarkdownConverter

Returns a new instance of SFMarkdownConverter.



51
52
53
54
55
56
57
58
# File 'lib/jekyll-img-converter.rb', line 51

def initialize(config)
  super
  @extensions = {}
  @config['redcarpet']['extensions'].each { |e| @extensions[e.to_sym] = true}
  @extensions = @config['redcarpet']['extensions'].each_with_object({}) do |e, hash|
    hash[e.to_sym] = true
  end
end

Instance Method Details

#convert(content) ⇒ Object



44
45
46
47
48
49
# File 'lib/jekyll-img-converter.rb', line 44

def convert(content)
  # @renderer.send :include, Redcarpet::Render::SmartyPants if @redcarpet_extensions[:smart]
  # markdown = Redcarpet::Markdown.new(@renderer.new(@extensions), @extensions)
  markdown = Redcarpet::Markdown.new(ImgConverter.new(@extensions), @extensions)
  markdown.render(content)
end

#matches(ext) ⇒ Object



36
37
38
# File 'lib/jekyll-img-converter.rb', line 36

def matches(ext)
  ext =~ /^.md(own)?$/i
end

#output_ext(ext) ⇒ Object



40
41
42
# File 'lib/jekyll-img-converter.rb', line 40

def output_ext(ext)
  ".html"
end