diff --git a/lib/jekyll/tags/highlight.rb b/lib/jekyll/tags/highlight.rb index eb069c27..067a487f 100644 --- a/lib/jekyll/tags/highlight.rb +++ b/lib/jekyll/tags/highlight.rb @@ -31,11 +31,11 @@ module Jekyll def render_pygments(context, code) if context["content_type"] == "markdown" - return "\n" + Albino.new(code, @lang).to_s(@options) + "\n" + return "\n" + add_code_tags(Albino.new(code, @lang).to_s(@options), @lang) + "\n" elsif context["content_type"] == "textile" - return "" + Albino.new(code, @lang).to_s(@options) + "" + return "" + add_code_tags(Albino.new(code, @lang).to_s(@options), @lang) + "" else - return Albino.new(code, @lang).to_s(@options) + return add_code_tags(Albino.new(code, @lang).to_s(@options), @lang) end end @@ -49,6 +49,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