Files
ai-web/app/Support/MarkdownRenderer.php

25 lines
433 B
PHP
Raw Normal View History

2026-02-11 17:28:36 +08:00
<?php
declare(strict_types=1);
namespace App\Support;
use Illuminate\Support\Str;
class MarkdownRenderer
{
public function render(?string $content): string
{
$markdown = trim((string) $content);
if ($markdown === '') {
return '';
}
return (string) Str::markdown($markdown, [
'html_input' => 'strip',
'allow_unsafe_links' => false,
]);
}
}