aboutsummaryrefslogtreecommitdiffstats
path: root/include/markdown.php
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2017-10-22 18:23:37 -0700
committerzotlabs <mike@macgirvin.com>2017-10-22 18:23:37 -0700
commit812d904c98d6fb3a4124f6e2415de5a139f954ce (patch)
treee1ff51523b02433e973118743e30aa9da9230b20 /include/markdown.php
parentc7d9a5ac91b3d256f31ebada4b38875905addb1f (diff)
downloadvolse-hubzilla-812d904c98d6fb3a4124f6e2415de5a139f954ce.tar.gz
volse-hubzilla-812d904c98d6fb3a4124f6e2415de5a139f954ce.tar.bz2
volse-hubzilla-812d904c98d6fb3a4124f6e2415de5a139f954ce.zip
bring back the markdown post feature (after investing some effort to make it work)
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);