In case anybody cares, I think I fixed the problem by filtering the 
contents of "to_add" through this method. My first attempt was to 
naive...  Now Instiki generates nice diffs again :)

   def self.balance_inline_tags(tags)
     result = []
     stack = []
     tags.each do |t|
       if t =~ /^<(\/)?(b|i|tt|em|strong|code|span)/
         if $1 # endtag
           if stack.last == $2
             stack.pop
           else
             # unbalanced end tag, generate start tag
             result.unshift "<#$2>"
           end
         else
           stack.push $2
         end
       end
       result << t
     end
     # unbalanced start tags, generate end tags
     stack.reverse_each {|t| result << "</#{t}>"}
     result
   end


bye
-- 
Stefan Matthias Aust // "Zweifel sind der Ansporn des Denkens..." -U