Skip to content

Commit

Permalink
implement a banner option in the kramdown engine
Browse files Browse the repository at this point in the history
  • Loading branch information
bmontgomery committed Aug 17, 2012
1 parent d95abeb commit 254f3c7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
5 changes: 3 additions & 2 deletions lib/markdown/engines/kramdown.rb
Expand Up @@ -11,6 +11,7 @@ def kramdown_to_html( content, options={} )
h[ :entity_output ] = options.fetch( 'entity_output',nil ) if options.fetch( 'entity_output', nil )
h[ :toc_levels ] = options.fetch( 'toc_levels',nil ) if options.fetch( 'toc_levels', nil )
h[ :smart_quotes ] = options.fetch( 'smart_quotes',nil ) if options.fetch( 'smart_quotes', nil )
h[ :banner ] = options.fetch( 'banner', true) if options.fetch( 'banner', nil)

puts " Converting Markdown-text (#{@content.length} bytes) to HTML using library kramdown (#{Kramdown::VERSION})"
puts " using options:"
Expand Down Expand Up @@ -43,9 +44,9 @@ def kramdown_to_html( content, options={} )
<!-- === end markdown block ===================================================== -->
EOS

content = banner_begin + content + banner_end
content = banner_begin + content + banner_end if h[ :banner ]

end

end # module Engine
end # module Markdown
end # module Markdown
4 changes: 4 additions & 0 deletions test/my_test.rb
@@ -0,0 +1,4 @@
load 'c:\source\other\markdown\lib\markdown.rb'

puts Markdown.new('# test', 'banner' => false).to_html
#puts Markdown.new('# test').to_html
5 changes: 3 additions & 2 deletions test/test_kramdown.rb
Expand Up @@ -12,7 +12,8 @@

# our own code

require 'lib/markdown'
# require 'lib/markdown'
require 'c:\source\other\markdown\lib\markdown.rb'


class TestKramdown < Test::Unit::TestCase
Expand All @@ -32,4 +33,4 @@ def test_to_html
end


end # class TestKramdown
end # class TestKramdown

0 comments on commit 254f3c7

Please sign in to comment.