" . $code . "\n"; }, $text); // 2. Inline kód (` ... `) $text = preg_replace('/`([^`]+)`/', '$1', $text); // 3. Nadpisy H1 - H6 $text = preg_replace('/^# (.*$)/m', '

$1

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

$1

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

$1

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

$1

', $text); $text = preg_replace('/^##### (.*$)/m', '
$1
', $text); $text = preg_replace('/^###### (.*$)/m', '
$1
', $text); // 4. Tučné a kurzíva $text = preg_replace('/\*\*(.*?)\*\*/', '$1', $text); $text = preg_replace('/\*(.*?)\*/', '$1', $text); // 5. Odkazy [text](url) $text = preg_replace('/\[(.*?)\]\((.*?)\)/', '$1', $text); // 6. Seznamy (- položka) // Nejdřív nahradíme jednotlivé položky $text = preg_replace('/^- (.*$)/m', '
  • $1
  • ', $text); // Pak obalíme souvislé bloky
  • do