stretch heading scale (h1→step-5, h3→step-1) + reduce heading bottom margin (space-l → space-m)

This commit is contained in:
Pontoporeia
2026-07-06 19:51:20 +02:00
parent 148ffe79f0
commit 0979267c68
5 changed files with 11 additions and 14 deletions
+2 -2
View File
@@ -6,7 +6,7 @@
class MarkdownHelper
{
/**
* Extract h1h3 headings from raw markdown content as TOC items.
* Extract h1 headings from raw markdown content as TOC items.
*
* Each heading gets an anchor id matching CommonMark's default slugification
* (lowercase, spaces → hyphens, punctuation stripped).
@@ -22,7 +22,7 @@ class MarkdownHelper
$normalizer = new \League\CommonMark\Normalizer\SlugNormalizer();
foreach ($lines as $line) {
if (preg_match('/^#{1,3}\s+(.+)$/', $line, $m)) {
if (preg_match('/^#\s+(.+)$/', $line, $m)) {
$label = trim($m[1]);
$id = $normalizer->normalize($label);
$items[] = ['label' => $label, 'href' => '#' . $id];