Files
MD2HTML/md2html.php
T
2026-10-26 18:33:57 +01:00

21 lines
490 B
PHP

<?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>';