Phase 1: Replace Parsedown with league/commonmark (4 call sites)

This commit is contained in:
Pontoporeia
2026-05-20 01:02:09 +02:00
parent 4683ba4116
commit 5e75cacad7
7 changed files with 18 additions and 21 deletions

View File

@@ -12,6 +12,8 @@ require_once __DIR__ . '/../../src/AdminAuth.php';
AdminAuth::requireLogin();
require_once __DIR__ . '/../../src/Database.php';
use League\CommonMark\CommonMarkConverter;
if (empty($_SESSION['csrf_token'])) {
$_SESSION['csrf_token'] = bin2hex(random_bytes(32));
}
@@ -91,10 +93,8 @@ function renderCollapsed(Database $db, string $key): void
$mdHtml = '';
if ($hasContent) {
require_once APP_ROOT . '/src/Parsedown.php';
$pd = new Parsedown();
$pd->setSafeMode(true);
$mdHtml = $pd->text($content);
$converter = new CommonMarkConverter(['html_input' => 'strip']);
$mdHtml = $converter->convert($content)->getContent();
}
?>
<div class="fhb-inline <?= $enabled ? '' : 'fhb-inline--disabled' ?>" data-key="<?= htmlspecialchars($key) ?>">