Add support for kramdown HTML converter options

http://kramdown.rubyforge.org/converter/html.html#options

  Example: In the _config.yaml,

  markdown: kramdown

  kramdown:
    auto_ids: true
This commit is contained in:
Jason Graham 2010-11-20 14:38:40 -08:00
parent ac7a0cc95f
commit f85e229a9e
3 changed files with 36 additions and 1 deletions

View File

@ -74,6 +74,12 @@ module Jekyll
},
'rdiscount' => {
'extensions' => []
},
'kramdown' => {
'auto_ids' => true,
'footnote_nr' => 1,
'entity_output' => 'as_char',
'toc_levels' => '1..6'
}
}

View File

@ -79,7 +79,12 @@ module Jekyll
setup
case @config['markdown']
when 'kramdown'
Kramdown::Document.new(content).to_html
Kramdown::Document.new(content, {
:auto_ids => @config['kramdown']['auto_ids'],
:footnote_nr => @config['kramdown']['footnote_nr'],
:entity_output => @config['kramdown']['entity_output'],
:toc_levels => @config['kramdown']['toc_levels']
}).to_html
when 'rdiscount'
RDiscount.new(content, *@rdiscount_extensions).to_html
when 'maruku'

24
test/test_kramdown.rb Normal file
View File

@ -0,0 +1,24 @@
require File.dirname(__FILE__) + '/helper'
class TestKramdown < Test::Unit::TestCase
context "kramdown" do
setup do
config = {
'markdown' => 'kramdown',
'kramdown' => { 'auto_ids' => false,
'footnote_nr' => 1,
'entity_output' => 'as_char',
'toc_levels' => '1..6'
}
}
@markdown = MarkdownConverter.new config
end
# http://kramdown.rubyforge.org/converter/html.html#options
should "pass kramdown options" do
assert_equal "<h1>Some Header</h1>", @markdown.convert('# Some Header #').strip
end
end
end