Parsedown Render
postsHere is a parsedownRender.php file for you to easily present your markdown files (e.g. test.md ). Let me know if it was helpful!
<?php
/*
Coder: Brian Khuu briankhuu.com
Purpose: To allow for displaying of .md file transparently to visitors via http://parsedown.org and mod_rewrite
Usage: Place this file (parsedownRender.php) in your root directory and add these lines below to your .htaccess file
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI} ^(.*)\.md
RewriteRule . /parsedownRender.php?css=/css/markdown1.css&file=%{REQUEST_URI} [L]
</IfModule>
*/
$file = "./".$_GET["file"]; // 'file' => /md/test.md
$css = ( $_GET['css']!="" ) ? htmlspecialchars($_GET['css']) : "/css/style.css";
function parsedownInclude($f){
require_once 'Parsedown.php';
$Parsedown = new Parsedown();
echo is_readable($f) ? $Parsedown->text(file_get_contents($f)) : "File Not Found: ".htmlspecialchars($f);
}
?>
<!DOCTYPE html>
<head><link rel="stylesheet" type="text/css" href="<?php echo $css ?>" /></head>
<body>
<?php parsedownInclude($file) ?>
</body>
</html>
Let me know if it helped you!