diff options
Diffstat (limited to 'include/markdown.php')
-rw-r--r-- | include/markdown.php | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/include/markdown.php b/include/markdown.php index 0cd9ab237..0464cf71a 100644 --- a/include/markdown.php +++ b/include/markdown.php @@ -49,14 +49,17 @@ function markdown_to_bb($s, $use_zrl = false, $options = []) { $s = $x['text']; - // Escaping the hash tags - doesn't always seem to work - // $s = preg_replace('/\#([^\s\#])/','\\#$1',$s); - // This seems to work + // Escaping the hash tags $s = preg_replace('/\#([^\s\#])/','#$1',$s); $s = MarkdownExtra::defaultTransform($s); - $s = str_replace("\r","",$s); + if($options && $options['preserve_lf']) { + $s = str_replace(["\r","\n"],["",'<br>'],$s); + } + else { + $s = str_replace("\r","",$s); + } $s = str_replace('#','#',$s); |