diff --git a/index.php b/index.php index bb303a5..4965702 100644 --- a/index.php +++ b/index.php @@ -211,6 +211,14 @@ class CodePressCMS { $body = preg_replace('/# (.+)/', '

$1

', $body); $body = preg_replace('/\*\*(.+?)\*\*/', '$1', $body); $body = preg_replace('/\*(.+?)\*/', '$1', $body); + + // Convert Markdown links to HTML links + $body = preg_replace('/\[([^\]]+)\]\(([^)]+)\)/', '$1', $body); + + // Convert relative internal links to CMS format + $body = preg_replace('/href="\/blog\/([^"]+)"/', 'href="?page=blog/$1"', $body); + $body = preg_replace('/href="\/([^"]+)"/', 'href="?page=$1"', $body); + $body = preg_replace('/\n\n/', '

', $body); $body = '

' . $body . '

'; $body = preg_replace('/

<\/p>/', '', $body);