Class: Jekyll::Converters::Markdown

Inherits:
Jekyll::Converter show all
Defined in:
lib/jekyll/converters/markdown.rb,
lib/jekyll/converters/markdown/maruku_parser.rb,
lib/jekyll/converters/markdown/kramdown_parser.rb,
lib/jekyll/converters/markdown/rdiscount_parser.rb,
lib/jekyll/converters/markdown/redcarpet_parser.rb

Defined Under Namespace

Classes: KramdownParser, MarukuParser, RDiscountParser, RedcarpetParser

Constant Summary

Constants inherited from Plugin

Plugin::PRIORITIES

Instance Method Summary collapse

Methods inherited from Jekyll::Converter

#initialize, pygments_prefix, #pygments_prefix, pygments_suffix, #pygments_suffix

Methods inherited from Plugin

<=>, inherited, #initialize, priority, safe, subclasses

Constructor Details

This class inherits a constructor from Jekyll::Converter

Instance Method Details

#convert(content) ⇒ Object



37
38
39
40
# File 'lib/jekyll/converters/markdown.rb', line 37

def convert(content)
  setup
  @parser.convert(content)
end

#matches(ext) ⇒ Object



28
29
30
31
# File 'lib/jekyll/converters/markdown.rb', line 28

def matches(ext)
  rgx = '(' + @config['markdown_ext'].gsub(',','|') +')'
  ext =~ Regexp.new(rgx, Regexp::IGNORECASE)
end

#output_ext(ext) ⇒ Object



33
34
35
# File 'lib/jekyll/converters/markdown.rb', line 33

def output_ext(ext)
  ".html"
end

#setupObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/jekyll/converters/markdown.rb', line 9

def setup
  return if @setup
  @parser = case @config['markdown']
    when 'redcarpet'
      RedcarpetParser.new @config
    when 'kramdown'
      KramdownParser.new @config
    when 'rdiscount'
      RDiscountParser.new @config
    when 'maruku'
      MarukuParser.new @config
    else
      STDERR.puts "Invalid Markdown processor: #{@config['markdown']}"
      STDERR.puts "  Valid options are [ maruku | rdiscount | kramdown | redcarpet ]"
      raise FatalException.new("Invalid Markdown process: #{@config['markdown']}")
  end
  @setup = true
end