--- redcloth3.rb.sav	2010-02-17 09:53:39.000000000 +0100
+++ redcloth3.rb.new	2010-02-17 15:17:32.000000000 +0100
@@ -293,7 +293,7 @@
 
         # start processor
         @pre_list = []
-        rip_offtags text
+        rip_offtags(text, false)
         no_textile text
         escape_html_tags text
         hard_break text 
@@ -611,7 +611,7 @@
         text.gsub!( CODE_RE ) do |m|
             before,lang,code,after = $~[1..4]
             lang = " lang=\"#{ lang }\"" if lang
-            rip_offtags( "#{ before }<code#{ lang }>#{ code }</code>#{ after }" )
+            rip_offtags( "#{ before }<code#{ lang }>#{ code }</code>#{ after }", false )
         end
     end
 
@@ -1049,7 +1049,7 @@
         end
     end
 
-    def rip_offtags( text )
+    def rip_offtags( text, escape_aftertag=true )
         if text =~ /<.*>/
             ## strip and encode <pre> content
             codepre, used_offtags = 0, {}
@@ -1063,7 +1063,7 @@
                         @pre_list.last << line
                         line = ""
                     else
-                        htmlesc( aftertag, :NoQuotes ) if aftertag
+                        htmlesc( aftertag, :NoQuotes ) if aftertag && escape_aftertag
                         line = "<redpre##{ @pre_list.length }>"
                         $3.match(/<#{ OFFTAGS }([^>]*)>/)
                         tag = $1
