I had the same problem and spent about 6 hours trying to figure out the problem. chronodm’s hack works well. In addition to chronodm’s hack, I also
changed clean_pre function into
function clean_pre($text) {
$text = str_replace(‘<br />’, ‘\n’, $text);
$text = str_replace(‘<p>’, “\n”, $text);
$text = str_replace(‘</p>’, ‘\n’, $text);
return $text;
}