diff options
| author | Michael Walker <mike@barrucadu.co.uk> | 2016-01-03 21:05:31 +0000 |
|---|---|---|
| committer | Michael Walker <mike@barrucadu.co.uk> | 2016-01-03 21:05:31 +0000 |
| commit | d46428b5b765f921b4cb633808f22ef303516c62 (patch) | |
| tree | 2bf0bba4b281b73107c74fa36d9fe7fb3ad48f10 /inc/functions.php | |
| parent | b5532240c88e2555d82c3fe9ba8e7f0e0fc89418 (diff) | |
Trim leading newlines and trailing whitespace from code blocks.
Diffstat (limited to 'inc/functions.php')
| -rwxr-xr-x | inc/functions.php | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/inc/functions.php b/inc/functions.php index cd1f8fde..ff5d51df 100755 --- a/inc/functions.php +++ b/inc/functions.php @@ -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); |
