diff --git a/block/TableTrait.php b/block/TableTrait.php index c7fc095..3d4d2c0 100644 --- a/block/TableTrait.php +++ b/block/TableTrait.php @@ -37,9 +37,8 @@ protected function consumeTable($lines, $current) 'cols' => [], 'rows' => [], ]; - $beginsWithPipe = $lines[$current][0] === '|'; for ($i = $current, $count = count($lines); $i < $count; $i++) { - $line = rtrim($lines[$i]); + $line = trim($lines[$i]); // extract alignment from second line if ($i == $current+1) { @@ -65,7 +64,7 @@ protected function consumeTable($lines, $current) continue; } - if ($line === '' || $beginsWithPipe && $line[0] !== '|') { + if ($line === '' || substr($lines[$i], 0, 4) === ' ') { break; } if ($line[0] === '|') { diff --git a/tests/extra-data/tables.html b/tests/extra-data/tables.html index 1011506..1968f49 100644 --- a/tests/extra-data/tables.html +++ b/tests/extra-data/tables.html @@ -84,6 +84,6 @@
3 | 4
diff --git a/tests/github-data/tables.html b/tests/github-data/tables.html index 09805bb..e3f2135 100644 --- a/tests/github-data/tables.html +++ b/tests/github-data/tables.html @@ -84,9 +84,9 @@3 | 4
| Table | With | Empty | Cells |
|---|