10-04-2026

This commit is contained in:
Kevin Adametz 2026-04-10 17:18:17 +02:00
parent 4d6b4930b2
commit 4bb89aad8c
836 changed files with 52961 additions and 5950 deletions

View file

@ -1,80 +1,14 @@
<?php
use function Livewire\Volt\{state, computed};
use Illuminate\Support\Str;
use League\CommonMark\CommonMarkConverter;
use League\CommonMark\Environment\Environment;
use League\CommonMark\Extension\CommonMark\CommonMarkCoreExtension;
use League\CommonMark\Extension\GithubFlavoredMarkdownExtension;
use League\CommonMark\MarkdownConverter;
use App\Services\ProjectDocumentationContent;
use function Livewire\Volt\computed;
use function Livewire\Volt\state;
state(['showToc' => false]);
$content = computed(function () {
$mdPath = base_path('dev/entwicklung.md');
if (!file_exists($mdPath)) {
return '<p class="text-red-600">Dokumentation nicht gefunden.</p>';
}
$markdown = file_get_contents($mdPath);
// Configure CommonMark with GitHub Flavored Markdown
$environment = new Environment([
'html_input' => 'allow',
'allow_unsafe_links' => false,
]);
$environment->addExtension(new CommonMarkCoreExtension());
$environment->addExtension(new GithubFlavoredMarkdownExtension());
$converter = new MarkdownConverter($environment);
return $converter->convert($markdown)->getContent();
});
// Extract Table of Contents from markdown
$tableOfContents = computed(function () {
$mdPath = base_path('dev/entwicklung.md');
if (!file_exists($mdPath)) {
return [];
}
$markdown = file_get_contents($mdPath);
$toc = [];
// Extract headings (## and ###)
preg_match_all('/^(#{2,3})\s+(.+)$/m', $markdown, $matches, PREG_SET_ORDER);
foreach ($matches as $match) {
$level = strlen($match[1]);
$title = trim($match[2]);
$slug = Str::slug($title);
$toc[] = [
'level' => $level,
'title' => $title,
'slug' => $slug,
];
}
return $toc;
});
$fileInfo = computed(function () {
$mdPath = base_path('dev/entwicklung.md');
if (!file_exists($mdPath)) {
return null;
}
return [
'size' => round(filesize($mdPath) / 1024, 1) . ' KB',
'modified' => \Carbon\Carbon::parse(filemtime($mdPath))->format('d.m.Y H:i'),
'lines' => count(file($mdPath)),
];
});
$content = computed(fn () => ProjectDocumentationContent::html());
$tableOfContents = computed(fn () => ProjectDocumentationContent::tableOfContents());
$fileInfo = computed(fn () => ProjectDocumentationContent::fileInfo());
?>