Skip to content

Commit 8a0fbf0

Browse files
committed
Cleanup for RDiscount TOC support. Closes jekyll#333.
1 parent 6471ebf commit 8a0fbf0

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

History.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* Allow setting of RedCloth options (#284)
66
* Add post_url Liquid tag for internal post linking (#369)
77
* Allow multiple plugin dirs to be specified (#438)
8+
* Inline TOC token support for RDiscount (#333)
89
* Bug Fixes
910
* Allow some special characters in highlight names
1011
* URL escape category names in URL generation (#360)

lib/jekyll/converters/markdown.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,8 @@ def convert(content)
119119
when 'rdiscount'
120120
rd = RDiscount.new(content, *@rdiscount_extensions)
121121
html = rd.to_html
122-
if rd.generate_toc and html.include? @config['rdiscount']['toc_token']
123-
html.gsub! @config['rdiscount']['toc_token'], rd.toc_content
122+
if rd.generate_toc and html.include?(@config['rdiscount']['toc_token'])
123+
html.gsub!(@config['rdiscount']['toc_token'], rd.toc_content)
124124
end
125125
html
126126
when 'maruku'

test/test_rdiscount.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ class TestRdiscount < Test::Unit::TestCase
55
context "rdiscount" do
66
setup do
77
config = {
8-
'rdiscount' => { 'extensions' => ['smart', 'generate_toc'], 'toc_token' => '{:toc}' },
9-
'markdown' => 'rdiscount'
8+
'markdown' => 'rdiscount',
9+
'rdiscount' => { 'extensions' => ['smart', 'generate_toc'], 'toc_token' => '{:toc}' }
1010
}
1111
@markdown = MarkdownConverter.new config
1212
end

0 commit comments

Comments
 (0)