Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to parse github readme.md raw file content in php

I need to parse readme.md file content using php to display content of my readme.md file.

for example I have below link for my readme.md raw file on github.

https://raw.githubusercontent.com/makadiyaharesh/CLImageEditor/master/README.md

I already fetch the content of file but need to display on my website using PHP code.

Currently when i display this content that is not formatted.

Please help me to do that.

1) Read the full file content.

2)Display that content using php and display in proper formatted view as show on github.

Sorry for my english.

Please help... Thanks in advance...

like image 338
Arvind Kanjariya Avatar asked Dec 08 '22 05:12

Arvind Kanjariya


1 Answers

.md files uses markdown syntax. you will need a markdown parser for this. check out - parsedown hope it will help.

include('Parsedown.php');
$contents = file_get_contents('README.md');
$Parsedown = new Parsedown();
echo $Parsedown->text($contents);
like image 69
Sougata Bose Avatar answered Dec 11 '22 11:12

Sougata Bose