Permalink
Browse files

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
  • Loading branch information...
1 parent ac7a0cc commit f85e229a9e99e8c9368928379e564bc8056ecd8a @jasongraham jasongraham committed Nov 20, 2010
Showing with 36 additions and 1 deletion.
  1. +6 −0 lib/jekyll.rb
  2. +6 −1 lib/jekyll/converters/markdown.rb
  3. +24 −0 test/test_kramdown.rb
View
@@ -74,6 +74,12 @@ module Jekyll
},
'rdiscount' => {
'extensions' => []
+ },
+ 'kramdown' => {
+ 'auto_ids' => true,
+ 'footnote_nr' => 1,
+ 'entity_output' => 'as_char',
+ 'toc_levels' => '1..6'
}
}
@@ -79,7 +79,12 @@ def convert(content)
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'
View
@@ -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

0 comments on commit f85e229

Please sign in to comment.