Here is version two of the parsedown based general .md file viewer

This time I added support for Math Jax, which will make it easier for me to post documents marked in LaTeX and ASCIIMaths. Which is very useful! Especially for future collaboration or documentation efforts.

Project: parsedown Render
Coder: Brian Khuu
VERSION: v2.0 (MathJax and raw view support now)
Purpose: To allow for displaying of .md file transparently to visitors via 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 [NC]
		RewriteRule . /parsedownRender.php?file=%{REQUEST_URI}&%{QUERY_STRING} [L]
$file = "./".$_GET["file"]; // 'file' => /md/
$css = isset($_GET['css']) ? htmlspecialchars($_GET['css']) : "";
$viewMode = isset($_GET['view']) ? htmlspecialchars($_GET['view']) : "";
if ( $viewMode == "raw"){ echo file_get_contents($file); exit(); }
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>
	<link rel="stylesheet" type="text/css" href="<?php echo $css ?>" />
	<script type="text/javascript" src=""></script>
<?php parsedownInclude($file); echo "<hr><a href='?view=raw'>VIEW RAW</a>"; ?>