diff options
-rw-r--r-- | markdown/extensions/tables.py | 3 | ||||
-rw-r--r-- | tests/extensions-x-tables/tables.html | 2 | ||||
-rw-r--r-- | tests/extensions-x-tables/tables.txt | 2 |
3 files changed, 3 insertions, 4 deletions
diff --git a/markdown/extensions/tables.py b/markdown/extensions/tables.py index 8eaa2d3..8ee1ce2 100644 --- a/markdown/extensions/tables.py +++ b/markdown/extensions/tables.py @@ -49,10 +49,9 @@ class TableTreeprocessor(markdown.treeprocessors.Treeprocessor): return result def run(self, root): - for element in self._findElement(root, "p"): for child in element: - if child.tail: + if child.tag in ['tr', 'th', 'td']: element.tag = "table" break diff --git a/tests/extensions-x-tables/tables.html b/tests/extensions-x-tables/tables.html index 55042dd..3377315 100644 --- a/tests/extensions-x-tables/tables.html +++ b/tests/extensions-x-tables/tables.html @@ -3,7 +3,7 @@ <tr><td> a </td><th> b </th></tr> <tr><td> <a href="#link">c</a> </td><td> <em>d</em> </td></tr> </table> -<p>Another</p> +<p><em>Another</em> <em>some inline markup</em></p> <table> <tr><td> a </td><td> b </td></tr> <tr><td> <em>a</em> </td><td> b </td></tr> diff --git a/tests/extensions-x-tables/tables.txt b/tests/extensions-x-tables/tables.txt index 70b4d36..60b34bd 100644 --- a/tests/extensions-x-tables/tables.txt +++ b/tests/extensions-x-tables/tables.txt @@ -3,7 +3,7 @@ Before | a |* b *| | [c](#link) | *d* | -Another +*Another* *some inline markup* | a | b | | _a_ | b | |