Parent

Methods

Files

Jekyll::Converters::Markdown::RedcarpetParser

Public Class Methods

new(config) click to toggle source
# File lib/jekyll/converters/markdown/redcarpet_parser.rb, line 40
def initialize(config)
  require 'redcarpet'
  @config = config
  @redcarpet_extensions = {}
  @config['redcarpet']['extensions'].each { |e| @redcarpet_extensions[e.to_sym] = true }

  @renderer ||= if @config['pygments']
                  Class.new(Redcarpet::Render::HTML) do
                    include WithPygments
                  end
                else
                  Class.new(Redcarpet::Render::HTML) do
                    include WithoutPygments
                  end
                end
rescue LoadError
  STDERR.puts 'You are missing a library required for Markdown. Please run:'
  STDERR.puts '  $ [sudo] gem install redcarpet'
  raise FatalException.new("Missing dependency: redcarpet")
end

Public Instance Methods

convert(content) click to toggle source
# File lib/jekyll/converters/markdown/redcarpet_parser.rb, line 61
def convert(content)
  @redcarpet_extensions[:fenced_code_blocks] = !@redcarpet_extensions[:no_fenced_code_blocks]
  @renderer.send :include, Redcarpet::Render::SmartyPants if @redcarpet_extensions[:smart]
  markdown = Redcarpet::Markdown.new(@renderer.new(@redcarpet_extensions), @redcarpet_extensions)
  markdown.render(content)
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.