Sha256: c813a7f812358228e9d8d8748c2abc4a6703d6169905fe96b3a600fe7920217d

Contents?: true

Size: 1.08 KB

Versions: 12

Compression:

Stored size: 1.08 KB

Contents

module Jekyll
  module Converters
    class Markdown < Converter
      safe true

      pygments_prefix "\n"
      pygments_suffix "\n"

      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

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

      def output_ext(ext)
        ".html"
      end

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

Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
jekyll-1.5.1 lib/jekyll/converters/markdown.rb
jekyll-1.5.0 lib/jekyll/converters/markdown.rb
jekyll-1.4.3 lib/jekyll/converters/markdown.rb
jekyll-1.4.2 lib/jekyll/converters/markdown.rb
jekyll-1.4.1 lib/jekyll/converters/markdown.rb
jekyll-1.4.0 lib/jekyll/converters/markdown.rb
jekyll-1.3.1 lib/jekyll/converters/markdown.rb
jekyll-1.3.0 lib/jekyll/converters/markdown.rb
jekyll-1.3.0.rc lib/jekyll/converters/markdown.rb
monad-0.0.3 lib/jekyll/converters/markdown.rb
jekyll-1.2.1 lib/jekyll/converters/markdown.rb
jekyll-1.2.0 lib/jekyll/converters/markdown.rb