summaryrefslogtreecommitdiff
path: root/cat.php
diff options
context:
space:
mode:
Diffstat (limited to 'cat.php')
-rw-r--r--cat.php17
1 files changed, 14 insertions, 3 deletions
diff --git a/cat.php b/cat.php
index 25afa6f..e43b75e 100644
--- a/cat.php
+++ b/cat.php
@@ -20,6 +20,7 @@
require 'config.php';
require 'common.php';
+require 'Parsedown.php';
global $config;
@@ -31,7 +32,17 @@ $cmd = $config['svn'] . ' cat --non-interactive ' .
'--password=' . $config['password'] . ' ' .
escapeshellarg($url);
-header('Content-Type: ' . GuessMimeType($fname));
-header('Content-Disposition: inline; filename="' . $fname . '"');
-passthru($cmd);
+if (IsMarkdown($fname))
+{
+ header('Content-Type: text/html');
+ $output = shell_exec($cmd);
+ $pd = new Parsedown();
+ echo $pd->text($output);
+}
+else
+{
+ header('Content-Type: ' . GuessMimeType($fname));
+ header('Content-Disposition: inline; filename="' . $fname . '"');
+ passthru($cmd);
+}
?>