Sha256: 7130335139295aa5bf81d952e2c709c42e3d1177520fecec62582207c0f84893

Contents?: true

Size: 964 Bytes

Versions: 12

Compression:

Stored size: 964 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']['enable_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

12 entries across 12 versions & 1 rubygems

Version Path
jekyll-3.0.0 lib/jekyll/converters/markdown/kramdown_parser.rb
jekyll-3.0.0.pre.rc1 lib/jekyll/converters/markdown/kramdown_parser.rb
jekyll-3.0.0.pre.beta10 lib/jekyll/converters/markdown/kramdown_parser.rb
jekyll-3.0.0.pre.beta9 lib/jekyll/converters/markdown/kramdown_parser.rb
jekyll-3.0.0.pre.beta8 lib/jekyll/converters/markdown/kramdown_parser.rb
jekyll-3.0.0.pre.beta7 lib/jekyll/converters/markdown/kramdown_parser.rb
jekyll-3.0.0.pre.beta6 lib/jekyll/converters/markdown/kramdown_parser.rb
jekyll-3.0.0.pre.beta5 lib/jekyll/converters/markdown/kramdown_parser.rb
jekyll-3.0.0.pre.beta4 lib/jekyll/converters/markdown/kramdown_parser.rb
jekyll-3.0.0.pre.beta3 lib/jekyll/converters/markdown/kramdown_parser.rb
jekyll-3.0.0.pre.beta2 lib/jekyll/converters/markdown/kramdown_parser.rb
jekyll-3.0.0.pre.beta1 lib/jekyll/converters/markdown/kramdown_parser.rb