Sha256: 77ba1cb4a990f51ac4e9999c0ee53baefd1795f22f07f6674c02b98e24df956c

Contents?: true

Size: 961 Bytes

Versions: 6

Compression:

Stored size: 961 Bytes

Contents

module Jekyll
  module Converters
    class Markdown
      class KramdownParser
        def initialize(config)
          require 'kramdown'
          @config = config
        rescue LoadError
          STDERR.puts 'You are missing a library required for Markdown. Please run:'
          STDERR.puts '  $ [sudo] gem install kramdown'
          raise Errors::FatalException.new("Missing dependency: kramdown")
        end

        def convert(content)
          # Check for use of coderay
          if @config['kramdown']['use_coderay']
            %w[wrap line_numbers line_numbers_start tab_width bold_every css default_lang].each do |opt|
              key = "coderay_#{opt}"
              @config['kramdown'][key] = @config['kramdown']['coderay'][key] unless @config['kramdown'].key?(key)
            end
          end

          Kramdown::Document.new(content, Utils.symbolize_hash_keys(@config["kramdown"])).to_html
        end

      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
jekyll-2.5.3 lib/jekyll/converters/markdown/kramdown_parser.rb
jekyll-2.5.2 lib/jekyll/converters/markdown/kramdown_parser.rb
jekyll-2.5.1 lib/jekyll/converters/markdown/kramdown_parser.rb
jekyll-2.5.0 lib/jekyll/converters/markdown/kramdown_parser.rb
jekyll-2.4.0 lib/jekyll/converters/markdown/kramdown_parser.rb
jekyll-2.3.0 lib/jekyll/converters/markdown/kramdown_parser.rb