<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
simonvomeyser / commonmark-ext-lazy-image example snippets
use League\CommonMark\Environment\Environment;
use League\CommonMark\Extension\CommonMark\CommonMarkCoreExtension;
use SimonVomEyser\CommonMarkExtension\LazyImageExtension;
$environment = new Environment([]);
$environment->addExtension(new CommonMarkCoreExtension())
->addExtension(new LazyImageExtension());
$converter = new MarkdownConverter($environment);
$html = $converter->convert('');
$environment = new Environment([
// ... other config
'lazy_image' => [
'strip_src' => true, // remove the "src" to add it later via js, optional
'html_class' => 'lozad', // the class that should be added, optional
'data_attribute' => 'src', // how the data attribute is named that provides the source to get picked up by js, optional
]
]);
$environment->addExtension(new CommonMarkCoreExtension())
->addExtension(new LazyImageExtension());
$converter = new MarkdownConverter($environment);
$html = $converter->convert('');
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.