simple_blog/common/php/md_read.php
manfromhuh fb1c649580 Update index.php to use the function
Also seperates the HTML used for just articles from the Markdown parsing.
2022-07-17 17:50:02 -04:00

15 lines
431 B
PHP

<?php
#Markdown parser dependancy
require ($_SERVER['DOCUMENT_ROOT'].'/common/vendor/autoload.php');
function read_md($MD_Path){
#Markdown parseing code.
echo $md_path;
$MD_Parser = new ParsedownExtra();
#$MD_Path = $md_path;
$MD_File = fopen($MD_Path, "r") or die("File not found.");
$MD_Text = fread($MD_File, filesize($MD_Path));
return $MD_Parser->text($MD_Text);
fclose($MD_File);
}
?>