Class: Jekyll::Converters::Markdown::RDiscountParser

Inherits:
Object
  • Object
show all
Defined in:
lib/jekyll/converters/markdown/rdiscount_parser.rb

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ RDiscountParser

Returns a new instance of RDiscountParser.



7
8
9
10
11
12
13
# File 'lib/jekyll/converters/markdown/rdiscount_parser.rb', line 7

def initialize(config)
  unless defined?(RDiscount)
    Jekyll::External.require_with_graceful_fail "rdiscount"
  end
  @config = config
  @rdiscount_extensions = @config["rdiscount"]["extensions"].map(&:to_sym)
end

Instance Method Details

#convert(content) ⇒ Object



15
16
17
18
19
20
21
22
# File 'lib/jekyll/converters/markdown/rdiscount_parser.rb', line 15

def convert(content)
  rd = RDiscount.new(content, *@rdiscount_extensions)
  html = rd.to_html
  if @config["rdiscount"]["toc_token"]
    html = replace_generated_toc(rd, html, @config["rdiscount"]["toc_token"])
  end
  html
end