fix logical mistake of HyperDown->optimizeBlocks

This commit is contained in:
Huspy 2018-03-06 15:58:08 +08:00
parent eae806390b
commit 04ff4b4c9c

View File

@ -1160,9 +1160,13 @@ class HyperDown
list ($type, $from, $to) = $block;
if ('pre' == $type) {
$isEmpty = array_reduce($lines, function ($result, $line) {
return preg_match("/^\s*$/", $line) && $result;
}, true);
$isEmpty = array_reduce(
array_slice($lines, $block[1], $block[2] - $block[1] + 1),
function ($result, $line) {
return preg_match("/^\s*$/", $line) && $result;
},
true
);
if ($isEmpty) {
$block[0] = $type = 'normal';