Skip to content

Commit

Permalink
Fix exception in HTML table parsing when table is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
gettalong committed Nov 17, 2024
1 parent f71a264 commit 9c40aa5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/kramdown/parser/html.rb
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ def is_simple_table?(el)
end
end
check_nr_cells.call(el)
return false if nr_cells == -1
return false if nr_cells == -1 || nr_cells == 0

alignment = nil
check_alignment = proc do |t|
Expand Down
3 changes: 3 additions & 0 deletions test/testcases/block/09_html/html_to_native/table_simple.html
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,6 @@
</td>
</tr>
</table>

<table>
</table>
3 changes: 3 additions & 0 deletions test/testcases/block/09_html/html_to_native/table_simple.text
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,6 @@ Some more
</td>
</tr>
</table>

<table>
</table>

0 comments on commit 9c40aa5

Please sign in to comment.