forked from 20xd6/simple_blog
Place Markdown parsing in a function
This commit is contained in:
parent
b4c852a3c1
commit
d719bcf101
@ -1,11 +1,15 @@
|
|||||||
<?php
|
<?php
|
||||||
#Markdown parser dependancy
|
#Markdown parser dependancy
|
||||||
require ($_SERVER['DOCUMENT_ROOT'].'/common/vendor/autoload.php');
|
require ($_SERVER['DOCUMENT_ROOT'].'/common/vendor/autoload.php');
|
||||||
#Markdown parseing code.
|
function read_md($md_path){
|
||||||
$MD_Parser = new ParsedownExtra();
|
#Markdown parseing code.
|
||||||
$MD_Path = "article.md";
|
$MD_Parser = new ParsedownExtra();
|
||||||
$MD_File = fopen($MD_Path, "r") or die("File not found.");
|
$MD_Path = $md_path;
|
||||||
$MD_Text = fread($MD_File, filesize($MD_Path));
|
$MD_File = fopen($MD_Path, "r") or die("File not found.");
|
||||||
|
$MD_Text = fread($MD_File, filesize($MD_Path));
|
||||||
|
$MD_Parser->text($MD_Text);
|
||||||
|
fclose($MD_File);
|
||||||
|
}
|
||||||
echo "<article id=\"article\">\n" . /* Adds the option to change the font size of the article text. */
|
echo "<article id=\"article\">\n" . /* Adds the option to change the font size of the article text. */
|
||||||
"<div id=\"font_btns\">
|
"<div id=\"font_btns\">
|
||||||
Text Size:
|
Text Size:
|
||||||
@ -24,8 +28,8 @@
|
|||||||
<li><a href=\"article.md\" title=\"Download \">MD</a></li>
|
<li><a href=\"article.md\" title=\"Download \">MD</a></li>
|
||||||
</nav>
|
</nav>
|
||||||
".
|
".
|
||||||
$MD_Parser->text($MD_Text) . "\n</article>";
|
read_md("article.md") . "\n</article>";
|
||||||
fclose($MD_File);
|
|
||||||
echo "\n</div><!--End of print-content div-->\n";
|
echo "\n</div><!--End of print-content div-->\n";
|
||||||
echo("<nav class=\"jmenu\"><div class=\"pmenu\"><ul id=\"back_btn\"><li><a href='..'>Back</a></li></ul></div></nav>\n");
|
echo("<nav class=\"jmenu\"><div class=\"pmenu\"><ul id=\"back_btn\"><li><a href='..'>Back</a></li></ul></div></nav>\n");
|
||||||
if ($tag_data != NULL){
|
if ($tag_data != NULL){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user