PHP code example of eberdna / commonmark-ext-prepend-image

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

    

eberdna / commonmark-ext-prepend-image example snippets

 php
use League\CommonMark\Environment;
use AndreBering\CommonMarkExtension\PrependImageExtension;

$this->environment = Environment::createCommonMarkEnvironment();
$this->environment->addExtension(new PrependImageExtension('/path/to/files/'));

$converter = new CommonMarkConverter([], $this->environment);
$html = $converter->convertToHtml('![alt text](image.jpg)');