Skip to content

Commit

Permalink
Cleanup for RDiscount TOC support. Closes jekyll#333.
Browse files Browse the repository at this point in the history
  • Loading branch information
mojombo committed Apr 23, 2012
1 parent 6471ebf commit 8a0fbf0
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions History.txt
Expand Up @@ -5,6 +5,7 @@
* Allow setting of RedCloth options (#284)
* Add post_url Liquid tag for internal post linking (#369)
* Allow multiple plugin dirs to be specified (#438)
* Inline TOC token support for RDiscount (#333)
* Bug Fixes
* Allow some special characters in highlight names
* URL escape category names in URL generation (#360)
Expand Down
4 changes: 2 additions & 2 deletions lib/jekyll/converters/markdown.rb
Expand Up @@ -119,8 +119,8 @@ def convert(content)
when 'rdiscount'
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
if rd.generate_toc and html.include?(@config['rdiscount']['toc_token'])
html.gsub!(@config['rdiscount']['toc_token'], rd.toc_content)
end
html
when 'maruku'
Expand Down
4 changes: 2 additions & 2 deletions test/test_rdiscount.rb
Expand Up @@ -5,8 +5,8 @@ class TestRdiscount < Test::Unit::TestCase
context "rdiscount" do
setup do
config = {
'rdiscount' => { 'extensions' => ['smart', 'generate_toc'], 'toc_token' => '{:toc}' },
'markdown' => 'rdiscount'
'markdown' => 'rdiscount',
'rdiscount' => { 'extensions' => ['smart', 'generate_toc'], 'toc_token' => '{:toc}' }
}
@markdown = MarkdownConverter.new config
end
Expand Down

0 comments on commit 8a0fbf0

Please sign in to comment.