PHP code example of skizu / gitdown

1. Go to this page and download the library: Download skizu/gitdown library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

skizu / gitdown example snippets


use Skizu\GitDown\GitDownConverter;

$gitDownConverter = new GitDownConverter('/path/to/repo');
echo $gitDownConverter->convertToHtml('path/to/file.md');

// <h1>Hello World!</h1>

use Skizu\GitDown\GitDownDiff
 
$gitDownDiff = new GitDownDiff('/path/to/repo');
$diff = $gitDownDiff->getDiff('master@{2 days ago}..master');
 
foreach($diff as $file => $data) {
   echo '<h1>'.$file.'<h1>';
   foreach($data['lines'] as $line) {
      echo $line;
   }
}
 
// <h1>README.md</h1>
// -* Fully support the CommonMark spec (100% compliance)\n
// +* Fully support the [CommonMark spec] (100% compliance)\n