diff options
-rw-r--r-- | markdown/extensions/tables.py | 3 | ||||
-rw-r--r-- | tests/extensions/extra/tables.html | 7 | ||||
-rw-r--r-- | tests/extensions/extra/tables.txt | 9 |
3 files changed, 15 insertions, 4 deletions
diff --git a/markdown/extensions/tables.py b/markdown/extensions/tables.py index 8c11739..7c75507 100644 --- a/markdown/extensions/tables.py +++ b/markdown/extensions/tables.py @@ -30,7 +30,8 @@ class TableProcessor(BlockProcessor): rows = block.split('\n') return (len(rows) > 1 and '|' in rows[0] and '|' in rows[1] and '-' in rows[1] and - rows[1].strip()[0] in ['|', ':', '-']) + rows[1].strip()[0] in ['|', ':', '-'] and + set(rows[1]) <= set('|:- ')) def run(self, parent, blocks): """ Parse a table block and build table. """ diff --git a/tests/extensions/extra/tables.html b/tests/extensions/extra/tables.html index b5c08be..85d9940 100644 --- a/tests/extensions/extra/tables.html +++ b/tests/extensions/extra/tables.html @@ -250,4 +250,9 @@ Content Cell | Content Cell <td>(<code>bar</code>) and <code>baz</code>.</td> </tr> </tbody> -</table>
\ No newline at end of file +</table> +<p>Lists are not tables</p> +<ul> +<li>this | should | not</li> +<li>be | a | table</li> +</ul>
\ No newline at end of file diff --git a/tests/extensions/extra/tables.txt b/tests/extensions/extra/tables.txt index c9ca70a..c843918 100644 --- a/tests/extensions/extra/tables.txt +++ b/tests/extensions/extra/tables.txt @@ -45,7 +45,7 @@ Three spaces in front of a table: | Content Cell | Content Cell | Four spaces is a code block: - + First Header | Second Header ------------ | ------------- Content Cell | Content Cell @@ -74,4 +74,9 @@ A test for issue #440: foo | bar --- | --- -foo | (`bar`) and `baz`.
\ No newline at end of file +foo | (`bar`) and `baz`. + +Lists are not tables + + - this | should | not + - be | a | table |