]> git.mxchange.org Git - friendica.git/commitdiff
Markdown - fixed bug in local anchor links, optimized replacer
authorpeter <peter@jean-luc-picard>
Sun, 3 Feb 2019 09:33:15 +0000 (10:33 +0100)
committerpeter <peter@jean-luc-picard>
Sun, 3 Feb 2019 09:33:15 +0000 (10:33 +0100)
src/Content/Text/Markdown.php

index 4e00ae78102624e8e2f66bdce15dc9415cf149ed..686a907b8f0f4b22ead1456ee80820ae6c43237f 100644 (file)
@@ -34,7 +34,7 @@ class Markdown extends BaseObject
                $MarkdownParser->hard_wrap = $hardwrap;
                $MarkdownParser->code_class_prefix = 'language-';
                $html = $MarkdownParser->transform($text);
-               $html = str_replace('<a href="#', '<a href="' . ltrim($_SERVER['REQUEST_URI'], '/') . '#', $html);
+               $html = preg_replace('/<a(.*?)href="#/is', '<a$1href="' . ltrim($_SERVER['REQUEST_URI'], '/') . '#', $html);
 
                self::getApp()->saveTimestamp($stamp1, "parser");