First Commit

This commit is contained in:
Esteban
2026-07-03 16:27:34 +02:00
commit 7a7440daab
8955 changed files with 1117958 additions and 0 deletions
+27
View File
@@ -0,0 +1,27 @@
<?php
namespace App\Support;
use League\CommonMark\CommonMarkConverter;
class MarkdownRenderer
{
public static function toHtml(?string $markdown): string
{
if (! $markdown) {
return '';
}
static $converter;
// html_input=strip: the source markdown comes from scraped third-party pages
// (or LLM output echoing back scraped content), so raw HTML must never be
// passed through as-is.
$converter ??= new CommonMarkConverter([
'html_input' => 'strip',
'max_nesting_level' => 100,
]);
return (string) $converter->convert($markdown);
}
}