/** * /runbook — Statische Notfall-Runbook-Seite des Towers (Server Component). * Karte tower-notfall-runbook, DATEI 2: rendert die Runbook-Datei als * schlichte Markdown-/Textseite — rein statisch, kein Script, keine * externen URLs, keine Secrets. Anker (#deadman etc.) kommen aus der MD. */ import { readFile } from "node:fs/promises" import path from "node:path" export const dynamic = "force-static" export const metadata = { title: "Notfall-Runbook Tower" } const MD_PATH = path.join(process.cwd(), "public", "runbook", "runbook-tower-notfall.md") /** Minimaler Markdown->HTML-Renderer (keine Dep, kein Script-Output). */ function renderMarkdown(md: string): string { const esc = (s: string) => s.replace(/&/g, "&").replace(//g, ">").replace(/"/g, """) const lines = md.split(/\r?\n/) const out: string[] = [] let inCode = false let listOpen = false const closeList = () => { if (listOpen) { out.push("") listOpen = false } } for (const raw of lines) { const line = raw // Bekannt-sichere Anker-Tags aus der Runbook-MD unverändert durchreichen // (Deep-Link-Ziele #deadman/#spool/#deadletter/#health). const anchor = line.match(/^<\/a>$/) if (anchor && !inCode) { out.push(``) continue } if (/^```/.test(line)) { closeList() out.push(inCode ? "" : '
')
      inCode = !inCode
      continue
    }
    if (inCode) {
      out.push(esc(line))
      continue
    }
    const h = line.match(/^(#{1,4})\s+(.*)$/)
    if (h) {
      closeList()
      const lvl = Math.min(h[1].length + 1, 5) // h1->h2 (Seitenh1 ist der Titel)
      out.push(`${esc(h[2])}`)
      continue
    }
    if (/^\s*[-*]\s+/.test(line)) {
      if (!listOpen) {
        out.push('