Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions markdown/extensions/tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class TableProcessor(BlockProcessor):

def test(self, parent, block):
rows = block.split('\n')
return (len(rows) > 2 and '|' in rows[0] and
return (len(rows) > 1 and '|' in rows[0] and
'|' in rows[1] and '-' in rows[1] and
rows[1].strip()[0] in ['|', ':', '-'])

Expand All @@ -36,7 +36,7 @@ def run(self, parent, blocks):
block = blocks.pop(0).split('\n')
header = block[0].strip()
seperator = block[1].strip()
rows = block[2:]
rows = [] if len(block) < 3 else block[2:]
# Get format type (bordered by pipes or not)
border = False
if header.startswith('|'):
Expand Down
11 changes: 10 additions & 1 deletion tests/extensions/extra/tables.html
Original file line number Diff line number Diff line change
Expand Up @@ -159,4 +159,13 @@ <h2>Table Tests</h2>
------------ | -------------
Content Cell | Content Cell
Content Cell | Content Cell
</code></pre>
</code></pre>
<table>
<thead>
<tr>
<th>First Header</th>
<th>Second Header</th>
</tr>
</thead>
<tbody></tbody>
</table>
3 changes: 3 additions & 0 deletions tests/extensions/extra/tables.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,6 @@ Four spaces is a code block:
------------ | -------------
Content Cell | Content Cell
Content Cell | Content Cell

| First Header | Second Header |
| ------------ | ------------- |