diff --git a/extensions/mentions/src/PostMentionsFormatter.php b/extensions/mentions/src/PostMentionsFormatter.php index f2c7e1bee..7d9c1ea30 100644 --- a/extensions/mentions/src/PostMentionsFormatter.php +++ b/extensions/mentions/src/PostMentionsFormatter.php @@ -1,6 +1,9 @@ parser = $parser; } - public function format($text, $post = null) + public function afterPurification($text, Post $post = null) { if ($post) { - $text = $this->parser->replace($text, function ($match) use ($post) { - return ''.$match['username'].''; - }, $text); + $text = $this->ignoreTags($text, ['a', 'code', 'pre'], function ($text) use ($post) { + return $this->parser->replace($text, function ($match) use ($post) { + return ''.$match['username'].''; + }, $text); + }); } return $text; } - - public function strip($text) - { - $text = $this->parser->replace($text, function () { - return ' '; - }); - - return $text; - } } diff --git a/extensions/mentions/src/UserMentionsFormatter.php b/extensions/mentions/src/UserMentionsFormatter.php index 9e2598373..9a9c6d275 100644 --- a/extensions/mentions/src/UserMentionsFormatter.php +++ b/extensions/mentions/src/UserMentionsFormatter.php @@ -1,6 +1,9 @@ parser = $parser; } - public function format($text, $post = null) + public function afterPurification($text, Post $post = null) { - $text = $this->parser->replace($text, function ($match) { - return ''.$match['username'].''; - }, $text); + $text = $this->ignoreTags($text, ['a', 'code', 'pre'], function ($text) { + return $this->parser->replace($text, function ($match) { + return ''.$match['username'].''; + }, $text); + }); return $text; }