protected function normalize($block)
    {
        // Remove any [whitespace]*'s from the start of each line
        $normalizedBlock = preg_replace('-^\s*\*+-m', '', $block);

        $indentSize = null;
        $blockLines = explode("\n", $normalizedBlock);
        $normalizedLines = array();
        foreach ($blockLines as $line) {
            preg_match('/^\s*/', $line, $matches);
            $precedingWhitespace = strlen($matches[0]);
            if ($indentSize === null) {
                $indentSize = $precedingWhitespace;
            }

            if ($indentSize <= $precedingWhitespace && $indentSize > 0) {
                $line = substr($line, $indentSize);
            }

            $normalizedLines[] = $line;
        }

        return trim(implode("\n", $normalizedLines));
    }