Fix guide deep links, code block styling

- Move heading IDs from hidden permalink anchors to parent headings so deep links scroll correctly (admin.php)
- Change code block background from dark to light gray (guide.php)
- Add pre/code CSS to frontend layout.mustache for visible code blocks
This commit is contained in:
2026-07-28 14:37:14 +02:00
parent 596b745bad
commit 0dc7b15fcf
3 changed files with 35 additions and 2 deletions
+8
View File
@@ -1417,6 +1417,14 @@ function handleGuide(AdminAuth $auth, array $config): void
$environment->addExtension(new \League\CommonMark\Extension\HeadingPermalink\HeadingPermalinkExtension());
$converter = new \League\CommonMark\MarkdownConverter($environment);
$content = $converter->convert($rawContent)->getContent();
// Move IDs from heading-permalink anchors to their parent headings
// so deep links scroll to the heading element itself (not a hidden anchor)
$content = preg_replace(
'~<h(\d)>(.*?)<a id="([^"]+)"[^>]*></a></h\1>~s',
'<h\1 id="\3">\2</h\1>',
$content
);
} else {
$content = '<pre>' . htmlspecialchars($rawContent) . '</pre>';
}