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.



5
6
7
8
9
# File 'lib/jekyll/converters/markdown/rdiscount_parser.rb', line 5

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

Instance Method Details

#convert(content) ⇒ Object



11
12
13
14
15
16
17
18
# File 'lib/jekyll/converters/markdown/rdiscount_parser.rb', line 11

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