diff --git a/index.php b/index.php index 11025f1..0faa47f 100644 --- a/index.php +++ b/index.php @@ -41,6 +41,9 @@ exit; } + require 'libs/Parsedown.php'; + $homelink = 'home '; + $action = ''; if (isset($_POST['action'])) $action = $_POST['action']; else if (isset($_GET['action'])) $action = $_GET['action']; @@ -70,7 +73,15 @@ rename($dir . '/' . $title, $dir . '/' . $title . '.del'); } - if ($action == 'open') + if ($action == 'preview') + { + $title = $_POST['title']; + $content = $_POST['content']; + $Parsedown = new Parsedown(); + $Parsedown->setBreaksEnabled(true); + echo $Parsedown->text('# ' . $title . "\r\n" . $content); + } + else if ($action == 'open') { $now = date("Y-m-d H.i.s", time()); if (!$param) @@ -94,11 +105,11 @@ $length = strlen($content); echo '