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

@@ -7,7 +7,6 @@
* string $helpKey — block key, used as element id.
*
* Outputs nothing when $helpContent is empty or whitespace-only.
* Parsedown must already be autoloaded (it is, via bootstrap → APP_ROOT/src/).
*/
$helpContent = trim($helpContent ?? '');
@@ -15,13 +14,11 @@ if ($helpContent === '') {
return;
}
require_once APP_ROOT . '/src/Parsedown.php';
$pd = new Parsedown();
$pd->setSafeMode(true);
$html = $pd->text($helpContent);
$converter = new League\CommonMark\CommonMarkConverter(['html_input' => 'strip']);
$html = $converter->convert($helpContent)->getContent();
?>
<div class="student-help-block" id="help-<?= htmlspecialchars($helpKey ?? 'unknown') ?>">
<?= $html ?>
</div>
<?php
unset($helpContent, $pd, $html);
unset($helpContent, $converter, $html);