ヘッダーIDの追加

This commit is contained in:
2026-02-27 02:11:17 +09:00
parent 22a7ca6ecb
commit 0bf04e7301

View File

@@ -80,6 +80,7 @@ class Markdown {
$tableRows = []; $tableRows = [];
$inTable = false; $inTable = false;
$i = 0; $i = 0;
$headerCount = 1;
foreach ($lines as $line) { foreach ($lines as $line) {
$i++; $i++;
@@ -196,7 +197,8 @@ class Markdown {
} }
$level = strlen($m[1]); $level = strlen($m[1]);
$this->html[] = " <h{$level}>".$this->parseInline($m[2])."</h{$level}>"; $this->html[] = " <h{$level} id=\"section-{$headerCount}\">".$this->parseInline($m[2])."</h{$level}>";
$headerCount++;
continue; continue;
} }