Sha256: 9b96c6ea8765e3250ae42020cd78c54fb2301b3f7c0fa7ad10d47d278a3fb0fa

Contents?: true

Size: 945 Bytes

Versions: 2

Compression:

Stored size: 945 Bytes

Contents

module Tigefa
  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 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'].has_key?(key)
            end
          end

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

      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tigefa-1.1.2 lib/tigefa/converters/markdown/kramdown_parser.rb
tigefa-1.1.1 lib/tigefa/converters/markdown/kramdown_parser.rb