diff options
Diffstat (limited to 'cat.php')
-rw-r--r-- | cat.php | 17 |
1 files changed, 14 insertions, 3 deletions
@@ -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); +} ?> |