Skip to content

Commit 183fe7c

Browse files
committed
Revert "wip"
This reverts commit 2c03329.
1 parent 2c03329 commit 183fe7c

File tree

4 files changed

+6
-5
lines changed

4 files changed

+6
-5
lines changed

Diff for: app/Markdown/MarkdownServiceProvider.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class MarkdownServiceProvider extends ServiceProvider
1414
{
1515
public function register(): void
1616
{
17-
$this->app->singleton(Converter::class, function () {
17+
$this->app->singleton(Converter::class, function ($app, array $params = []) {
1818
$environment = new Environment([
1919
'html_input' => 'escape',
2020
'max_nesting_level' => 10,
@@ -29,6 +29,7 @@ public function register(): void
2929
'external_link' => [
3030
'internal_hosts' => config('app.host'),
3131
'open_in_new_window' => true,
32+
'nofollow' => ($params['nofollow'] ?? true) ? 'external' : '',
3233
],
3334
]);
3435

Diff for: app/Models/Article.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public function body(): string
100100

101101
public function excerpt(int $limit = 100): string
102102
{
103-
return Str::limit(strip_tags(md_to_html($this->body())), $limit);
103+
return Str::limit(strip_tags(md_to_html($this->body(), false)), $limit);
104104
}
105105

106106
public function hasHeroImageAuthor(): bool

Diff for: resources/helpers.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ function is_active(mixed $routes): bool
2424
/**
2525
* Converts Markdown to a safe HTML string.
2626
*/
27-
function md_to_html(string $markdown): string
27+
function md_to_html(string $markdown, bool $nofollow = true): string
2828
{
29-
return app(App\Markdown\Converter::class)->toHtml($markdown);
29+
return app(App\Markdown\Converter::class, ['nofollow' => $nofollow])->toHtml($markdown);
3030
}
3131
}
3232

Diff for: resources/views/articles/show.blade.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ class="w-full bg-center bg-gray-800"
121121
x-init="$nextTick(function () { highlightCode($el); })"
122122
class="prose prose-lg text-gray-800 prose-lio"
123123
>
124-
{!! md_to_html($article->body()) !!}
124+
{!! md_to_html($article->body(), false) !!}
125125
</div>
126126

127127
@if ($article->isUpdated())

0 commit comments

Comments
 (0)