$1', $text); $text = preg_replace('/^## (.*$)/m', '

$1

', $text); $text = preg_replace('/^### (.*$)/m', '

$1

', $text); // Tučné a kurzíva $text = preg_replace('/\*\*(.*?)\*\*/', '$1', $text); $text = preg_replace('/\*(.*?)\*/', '$1', $text); // Odkazy [text](url) $text = preg_replace('/\[(.*?)\]\((.*?)\)/', '$1', $text); // Kódové bloky ``` ... ``` $text = preg_replace('/```(.*?)```/s', '
$1
', $text); // Inline kód ` ... ` $text = preg_replace('/`(.*?)`/', '$1', $text); // Seznamy - $text = preg_replace('/^- (.*$)/m', '
  • $1
  • ', $text); $text = preg_replace('/(
  • .*<\/li>\n?)+/', '', $text); // Odstranění prázdných řádků a převod na

    $text = preg_replace('/\n\n+/', '

    ', $text); $text = '

    ' . $text . '

    '; // Čištění $text = str_replace('

    ', '

    ', $text); $text = str_replace('

    ', '', $text); return $text; } // Převod $htmlContent = markdownToHtml($markdownContent); // Získání titulku z prvního řádku (pro a <h1>) $title = $slug; if (preg_match('/^# (.*$)/m', $markdownContent, $matches)) { $title = $matches[1]; } // Datum (z prvního řádku > Datum: ...) $date = date('Y-m-d'); if (preg_match('/> Datum: (.*$)/m', $markdownContent, $dateMatches)) { $date = $dateMatches[1]; } // Obsah stránky $content = ' <article> <h1 class="article-title">' . htmlspecialchars($title) . '</h1> <span class="article-date">' . htmlspecialchars($date) . '</span> <div class="content-body"> ' . $htmlContent . ' </div> </article> '; $pageTitle = $title . ' - EndeavourOS CZ'; require PATH_TEMPLATES . 'base.php'; ?>