false]); $content = computed(function () { $mdPath = base_path('dev/entwicklung.md'); if (!file_exists($mdPath)) { return '
Dokumentation nicht gefunden.
'; } $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)), ]; }); ?>