Skip to content

Commit 8d20c71

Browse files
pushpak1300joedixon
authored andcommitted
Apply suggestions from code review
Co-authored-by: Joe Dixon <joedixon@users.noreply.github.com>
1 parent f111f80 commit 8d20c71

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

resources/helpers.php

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,14 @@ function route_to_reply_able($replyAble): string
3232
}
3333
}
3434

35-
if (! function_exists('linkyfy')) {
35+
if (! function_exists('replace_links')) {
3636
/**
3737
* Convert Standalone Urls to HTML.
3838
*/
39-
function linkyfy(string $markdown): string
39+
function replace_links(string $markdown): string
4040
{
41-
$lf=new LinkFinder([
42-
"attrs" => ["class" => "external-link", "target" => "_blank", "rel" => "nofollow"],
43-
"mailto_attrs" => ["class" => "external-email"]
44-
]);
45-
return $lf->processHtml($markdown);
41+
return (new LinkFinder([
42+
"attrs" => ["target" => "_blank", "rel" => "nofollow"],
43+
]))->processHtml($markdown);
4644
}
4745
}

resources/views/forum/threads/show.blade.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class="text-green-darker mr-2">
4141
class="forum-content"
4242
x-data="{}"
4343
x-init="function () { highlightCode($el); }"
44-
x-html="{{ json_encode(linkyfy(md_to_html($thread->body()))) }}"
44+
x-html="{{ json_encode(replace_links(md_to_html($thread->body()))) }}"
4545
>
4646
</div>
4747
</div>
@@ -118,7 +118,7 @@ class="forum-content"
118118
class="forum-content"
119119
x-data="{}"
120120
x-init="function () { highlightCode($el); }"
121-
x-html="{{ json_encode(linkyfy(md_to_html($reply->body()))) }}"
121+
x-html="{{ json_encode(replace_links(md_to_html($reply->body()))) }}"
122122
>
123123
</div>
124124
</div>

0 commit comments

Comments
 (0)