diff --git a/lib/jekyll/tags/highlight.rb b/lib/jekyll/tags/highlight.rb index eb069c27..93d94868 100644 --- a/lib/jekyll/tags/highlight.rb +++ b/lib/jekyll/tags/highlight.rb @@ -30,12 +30,11 @@ module Jekyll end def render_pygments(context, code) + output = add_code_tags(Albino.new(code, @lang).to_s(@options), @lang) if context["content_type"] == "markdown" - return "\n" + Albino.new(code, @lang).to_s(@options) + "\n" + return "\n" + output + "\n" elsif context["content_type"] == "textile" - return "" + Albino.new(code, @lang).to_s(@options) + "" - else - return Albino.new(code, @lang).to_s(@options) + return "" + output + "" end end @@ -49,6 +48,13 @@ module Jekyll HTML end + + def add_code_tags(code, lang) + # Add nested tags to code blocks + code = code.sub(/
/,'
')
+      code = code.sub(/<\/pre>/,"
") + end + end end diff --git a/test/test_tags.rb b/test/test_tags.rb index 0c3caa6d..64119572 100644 --- a/test/test_tags.rb +++ b/test/test_tags.rb @@ -49,7 +49,7 @@ CONTENT end should "render markdown with pygments line handling" do - assert_match %{
test\n
}, @result + assert_match %{
test\n
}, @result end end @@ -59,7 +59,7 @@ CONTENT end should "render markdown with pygments line handling" do - assert_match %{
Æ\n
}, @result + assert_match %{
Æ\n
}, @result end end