PHP code example of calebporzio / gitdown

1. Go to this page and download the library: Download calebporzio/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/ */

    

calebporzio / gitdown example snippets


// Optionally set a GitHub Personal Access Token to increase rate-limit.
GitDown::setToken($token);

GitDown::parse($markdown);

// Uses Laravel's cache()->rememberForever() under the hood.
GitDown::parseAndCache($markdown);

GitDown::parse($markdown);

// Will be cached forever. (suggested)
GitDown::parseAndCache($markdown);

// Will be cached for 24 hours. (minutes in Laravel < 5.8, seconds otherwise)
GitDown::parseAndCache($markdown, $seconds = 86400);

// Pass in your own custom caching strategy.
GitDown::parseAndCache($markdown, function ($parse) {
    return Cache::rememberForever(sha1($markdown), function () use ($parse) {
        return $parse();
    });
});

"allowedTags" => [
    'iframe',
],

// You can pass config options into the constructur:
$gitDown = new GitDown\GitDown(
    $token = 'foo',
    $context = 'your/repo',
    $allowedTags = []
);

$gitDown->parse($markdown);

// Pass in your own custom caching strategy.
$gitDown->parseAndCache($markdown, function ($parse) {
    return Cache::rememberForever(sha1($markdown), function () use ($parse) {
        return $parse();
    });
});


"context" => "your/repo",
html
<head>
    [...]
    <style> echo GitDown\GitDown::styles();