Index: trac/wiki/formatter.py
===================================================================
--- trac/wiki/formatter.py	(revision 7601)
+++ trac/wiki/formatter.py	(working copy)
@@ -61,6 +61,8 @@
 class WikiProcessor(object):
 
     _code_block_re = re.compile('^<div(?:\s+class="([^"]+)")?>(.*)</div>$')
+    _block_elem_re = re.compile(r'^\s*<(?:div|table)(?:\s+[^>]+)?>',
+                                re.I | re.M)
 
     def __init__(self, formatter, name, args={}):
         """Find the processor by name
@@ -206,13 +208,13 @@
                     interrupt_paragraph = True
             else:
                 text = to_unicode(text)
-                match = re.match(self._code_block_re, unicode(text))
+                match = re.match(self._code_block_re, text)
                 if match:
                     if match.group(1) and 'code' in match.group(1):
                         content_for_span = match.group(2)
                     else:
                         interrupt_paragraph = True
-                elif text.startswith('<table'):
+                elif re.match(self._block_elem_re, text):
                     interrupt_paragraph = True
             if content_for_span:
                 text = tag.span(class_='code-block')(*content_for_span)

