diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/markdown.php | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/include/markdown.php b/include/markdown.php index a20c0d8ba..1c42937b3 100644 --- a/include/markdown.php +++ b/include/markdown.php @@ -152,6 +152,7 @@ function markdown_to_bb($s, $use_zrl = false, $options = []) { + function bb_to_markdown($Text) { /* @@ -161,6 +162,7 @@ function bb_to_markdown($Text) { $Text = preg_replace_callback('/#\[([zu])rl\=(\w+.*?)\](\w+.*?)\[\/[(zu)]rl\]/i', create_function('$match', 'return \'#\'. str_replace(\' \', \'_\', $match[3]);'), $Text); + $Text = preg_replace('/#\^\[([zu])rl\=(\w+.*?)\](\w+.*?)\[\/([zu])rl\]/i', '[$1rl=$2]$3[/$4rl]', $Text); // Converting images with size parameters to simple images. Markdown doesn't know it. @@ -173,17 +175,14 @@ function bb_to_markdown($Text) { $Text = bbcode($Text, $preserve_nl, false); // Markdownify does not preserve previously escaped html entities such as <> and &. - $Text = str_replace(array('<','>','&'),array('&_lt_;','&_gt_;','&_amp_;'),$Text); // Now convert HTML to Markdown - $md = new HtmlConverter(); - $Text = $md->convert($Text); + $Text = html2markdown($Text); // It also adds backslashes to our attempt at getting around the html entity preservation for some weird reason. - $Text = str_replace(array('&\\_lt\\_;','&\\_gt\\_;','&\\_amp\\_;'),array('<','>','&'),$Text); // If the text going into bbcode() has a plain URL in it, i.e. @@ -204,4 +203,4 @@ function bb_to_markdown($Text) { return $Text; -}
\ No newline at end of file +} |