mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-08-10 15:21:22 +02:00
stretch heading scale (h1→step-5, h3→step-1) + reduce heading bottom margin (space-l → space-m)
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
class MarkdownHelper
|
||||
{
|
||||
/**
|
||||
* Extract h1–h3 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];
|
||||
|
||||
Reference in New Issue
Block a user