PHP code example of torchlight / torchlight-commonmark

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

    

torchlight / torchlight-commonmark example snippets


'extensions' => [
    // Torchlight syntax highlighting
    TorchlightExtension::class,
],

// CommonMark V1
$environment = Environment::createCommonMarkEnvironment();
$environment->addExtension(new TorchlightExtension);

// CommonMark V2
$environment = new Environment();
$environment->addExtension(new CommonMarkCoreExtension);
$environment->addExtension(new TorchlightExtension);


return [
    // The Torchlight client caches highlighted code blocks. Here
    // you can define which cache driver you'd like to use.
    'cache' => env('TORCHLIGHT_CACHE_DRIVER'),

    // Which theme you want to use. You can find all of the themes at
    // https://torchlight.dev/themes, or you can provide your own.
    'theme' => env('TORCHLIGHT_THEME', 'material-theme-palenight'),

    // Your API token from torchlight.dev.
    'token' => env('TORCHLIGHT_TOKEN'),

    // If you want to register the blade directives, set this to true.
    'blade_components' => true,

    // The Host of the API.
    'host' => env('TORCHLIGHT_HOST', 'https://api.torchlight.dev'),
];
shell
php artisan torchlight:install