diff --git a/Parsedown.php b/Parsedown.php index 186896c..d62c6c8 100755 --- a/Parsedown.php +++ b/Parsedown.php @@ -1610,8 +1610,6 @@ class Parsedown protected function elementApplyRecursive($closure, array $Element) { - $Element = call_user_func($closure, $Element); - if (isset($Element['elements'])) { $Element['elements'] = $this->elementsApplyRecursive($closure, $Element['elements']); @@ -1621,6 +1619,8 @@ class Parsedown $Element['element'] = $this->elementApplyRecursive($closure, $Element['element']); } + $Element = call_user_func($closure, $Element); + return $Element; }