From f5b2acf8cd84e986d374361f6d5b0c732df2dd96 Mon Sep 17 00:00:00 2001 From: Michishige Kaito Date: Sun, 15 May 2011 20:05:22 +0100 Subject: [PATCH] Added support for inline TOCs with RDiscount --- lib/jekyll/converters/markdown.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/jekyll/converters/markdown.rb b/lib/jekyll/converters/markdown.rb index 78e313d9..32820ef4 100644 --- a/lib/jekyll/converters/markdown.rb +++ b/lib/jekyll/converters/markdown.rb @@ -117,7 +117,12 @@ module Jekyll }).to_html end when 'rdiscount' - RDiscount.new(content, *@rdiscount_extensions).to_html + rd = RDiscount.new(content, *@rdiscount_extensions) + html = rd.to_html + if rd.generate_toc and html.include? @config['rdiscount']['toc_token'] + html.gsub! @config['rdiscount']['toc_token'], rd.toc_content + end + html when 'maruku' Maruku.new(content).to_html end