Initial commit
This commit is contained in:
+20
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
require 'vendor/autoload.php';
|
||||
|
||||
$path = $_GET['file'] ?? $_SERVER['REQUEST_URI'];
|
||||
$file = realpath('d:/www/' . $path);
|
||||
|
||||
if (!$file || !str_ends_with($file, '.md')) {
|
||||
http_response_code(404);
|
||||
exit('Not found');
|
||||
}
|
||||
|
||||
$md = file_get_contents($file);
|
||||
$parser = new Parsedown();
|
||||
|
||||
echo '<!doctype html>';
|
||||
echo '<meta charset="utf-8">';
|
||||
echo '<link rel="stylesheet" href="//localhost/md2html/markdown.css">';
|
||||
echo '<div class="markdown-body">';
|
||||
echo $parser->text($md);
|
||||
echo '</div>';
|
||||
Reference in New Issue
Block a user