Lazy load images

This commit is contained in:
Belle Aerni 2023-02-25 04:32:07 -08:00
parent 404c093ccb
commit cba9f71f78
3 changed files with 56 additions and 2 deletions

View file

@ -16,7 +16,8 @@
"twig/twig": "^3.5",
"shapecode/twig-string-loader": "^1.1",
"embed/embed": "^4.4",
"nyholm/psr7": "^1.5"
"nyholm/psr7": "^1.5",
"simonvomeyser/commonmark-ext-lazy-image": "^2.0"
},
"authors": [
{

53
composer.lock generated
View file

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "c5ca069c1cb40f460516e523125a2eca",
"content-hash": "0e7b539782d869814d383d3b41cd43a5",
"packages": [
{
"name": "composer/ca-bundle",
@ -1201,6 +1201,57 @@
],
"time": "2022-01-15T12:43:29+00:00"
},
{
"name": "simonvomeyser/commonmark-ext-lazy-image",
"version": "v2.0.3",
"source": {
"type": "git",
"url": "https://github.com/simonvomeyser/commonmark-ext-lazy-image.git",
"reference": "38c2b017ee8af71ca2cf5e052e0719ee51847c5e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/simonvomeyser/commonmark-ext-lazy-image/zipball/38c2b017ee8af71ca2cf5e052e0719ee51847c5e",
"reference": "38c2b017ee8af71ca2cf5e052e0719ee51847c5e",
"shasum": ""
},
"require": {
"league/commonmark": "^2.0",
"php": "^7.4 || ^8.0"
},
"require-dev": {
"phpunit/phpunit": "^9.0"
},
"type": "commonmark-extension",
"autoload": {
"psr-4": {
"SimonVomEyser\\CommonMarkExtension\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Simon vom Eyser",
"email": "simon.vom.eyser@gmail.com"
}
],
"description": "Adds support for lazy images to the phpleague/commonmark markdown parser package",
"keywords": [
"commonmark",
"extension",
"image",
"lazy",
"markdown"
],
"support": {
"issues": "https://github.com/simonvomeyser/commonmark-ext-lazy-image/issues",
"source": "https://github.com/simonvomeyser/commonmark-ext-lazy-image/tree/v2.0.3"
},
"time": "2022-09-15T14:58:51+00:00"
},
{
"name": "symfony/deprecation-contracts",
"version": "v3.0.2",

View file

@ -14,6 +14,7 @@ use League\CommonMark\MarkdownConverter;
use ElGigi\CommonMarkEmoji\EmojiExtension;
use League\CommonMark\Extension\Embed\Bridge\OscaroteroEmbedAdapter;
use League\CommonMark\Extension\Embed\EmbedExtension;
use SimonVomEyser\CommonMarkExtension\LazyImageExtension;
class AntMarkdown
{
@ -50,6 +51,7 @@ class AntMarkdown
$environment->addExtension(new TaskListExtension());
$environment->addExtension(new EmojiExtension());
$environment->addExtension(new EmbedExtension());
$environment->addExtension(new LazyImageExtension());
$markdownConverter = new MarkdownConverter($environment);