$1', $content);
$content = preg_replace('/__(.+?)__/', '$1', $content);
// Italic: *text* or _text_
$content = preg_replace('/\*(.+?)\*/', '$1', $content);
$content = preg_replace('/_(.+?)_/', '$1', $content);
// Strikethrough: ~~text~~
$content = preg_replace('/~~(.+?)~~/', '$1', $content);
// Underline: __text__
$content = preg_replace('/\|\|(.+?)\|\|/', '$1', $content);
// Code inline: `code`
$content = preg_replace('/`([^`]+)`/', '$1', $content);
// Code block: ```code```
$content = preg_replace('/```([^`]+)```/s', '
$1', $content);
// Links: [text](url)
$content = preg_replace('/\[([^\]]+)\]\(([^\)]+)\)/', '$1', $content);
// Auto-link URLs
$content = preg_replace('/(https?:\/\/[^\s<]+)/', '$1', $content);
// Line breaks
$content = nl2br($content);
return $content;
}
}