aboutsummaryrefslogtreecommitdiffstats
path: root/include/markdown.php
diff options
context:
space:
mode:
authorHaakon Meland Eriksen <haakon.eriksen@far.no>2017-10-24 06:03:09 +0200
committerHaakon Meland Eriksen <haakon.eriksen@far.no>2017-10-24 06:03:09 +0200
commitc99962106d6f9a65f01c2be4a9708d35dec7ca90 (patch)
treeb8c9439eaa107f03aae314146a21340e9e47d2b5 /include/markdown.php
parentf648809856b852d3819a8c1a0d624fd725ed8a34 (diff)
parente67ff5c122087f878111ad99d1c3b2328b967ab2 (diff)
downloadvolse-hubzilla-c99962106d6f9a65f01c2be4a9708d35dec7ca90.tar.gz
volse-hubzilla-c99962106d6f9a65f01c2be4a9708d35dec7ca90.tar.bz2
volse-hubzilla-c99962106d6f9a65f01c2be4a9708d35dec7ca90.zip
Merge branch 'dev' of https://github.com/redmatrix/hubzilla into dev
Diffstat (limited to 'include/markdown.php')
-rw-r--r--include/markdown.php11
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\#])/','&#35;$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('&#35;','#',$s);