diff --git a/app/Services/ParsableContentProviders/HashtagProviderParsable.php b/app/Services/ParsableContentProviders/HashtagProviderParsable.php index 2df4d337e..3d8599349 100644 --- a/app/Services/ParsableContentProviders/HashtagProviderParsable.php +++ b/app/Services/ParsableContentProviders/HashtagProviderParsable.php @@ -14,10 +14,10 @@ public function parse(string $content): string { return (string) preg_replace_callback( - '/(]*>.*?<\/a>)|(?]*>.*?<\/\2>)|(? $matches[1] !== '' ? $matches[1] - : '#'.$matches[2].'', + : '#'.$matches[3].'', $content ); } diff --git a/tests/Unit/Services/ContentProvidersTest.php b/tests/Unit/Services/ContentProvidersTest.php index 2f39932b0..9cb734082 100644 --- a/tests/Unit/Services/ContentProvidersTest.php +++ b/tests/Unit/Services/ContentProvidersTest.php @@ -276,7 +276,19 @@ 'parsed' => 'Existing link with #segment and a #hashtag.', ], [ - 'content' => 'It'll work with html escapes.', - 'parsed' => 'It'll work with html escapes.', + 'content' => 'It'll work with html escapes.', + 'parsed' => 'It'll work with html escapes.', + ], + [ + 'content' => 'It works with
+ multiline $codeBlocks = true;
+ #comment
+
+ #hashtag',
+ 'parsed' => 'It works with
+ multiline $codeBlocks = true;
+ #comment
+
+ #hashtag',
],
]);