Trim leading newlines and trailing whitespace from code blocks.
This commit is contained in:
parent
b5532240c8
commit
d46428b5b7
@ -2085,6 +2085,8 @@ function markup(&$body, $track_cites = false) {
|
||||
$code = isset($val[2]) ? $val[2] : $val[1];
|
||||
$code_lang = isset($val[2]) ? $val[1] : "";
|
||||
|
||||
$code = rtrim(ltrim($code, "\r\n"));
|
||||
|
||||
$code = "<pre class='code lang-$code_lang'>".str_replace(array("\n","\t"), array(" ","	"), htmlspecialchars($code))."</pre>";
|
||||
|
||||
$body = str_replace("<code $id>", $code, $body);
|
||||
|
Loading…
Reference in New Issue
Block a user