Skip to content

Commit

Permalink
feat(hashtags): increase permitted length of hashtags to 200 chars
Browse files Browse the repository at this point in the history
  • Loading branch information
steven-fox committed Aug 19, 2024
1 parent 2511e4d commit cfe4b34
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ public function parse(string $content): string
'/(<(a|code|pre)\s+[^>]*>.*?<\/\2>)|(?<!&)#([a-z0-9]+)/is',
fn (array $matches): string => $matches[1] !== ''
? $matches[1]
: '<span class="text-blue-500">#'.Str::limit($matches[3], 50, '').'</span>',
: sprintf(
'<span class="text-blue-500">#%s</span>',
Str::limit($matches[3], 200, '')
),
$content
);
}
Expand Down
4 changes: 2 additions & 2 deletions tests/Unit/Services/ContentProvidersTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@
<span class="text-blue-500">#hashtag</span>',
],
[
'content' => '#extremelylonghashtagswontbeallowedaaaaaaaaaaaaaaaab', // 51 chars
'parsed' => '<span class="text-blue-500">#extremelylonghashtagswontbeallowedaaaaaaaaaaaaaaaa</span>', // 50 chars
'content' => '#extremelylonghashtagswillbeallowedaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
'parsed' => '<span class="text-blue-500">#extremelylonghashtagswillbeallowedaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</span>',
],
]);

0 comments on commit cfe4b34

Please sign in to comment.