From cba9f71f7862bc2e7e1d98bb382fa7a75c9f85dd Mon Sep 17 00:00:00 2001 From: Belle Aerni Date: Sat, 25 Feb 2023 04:32:07 -0800 Subject: [PATCH] Lazy load images --- composer.json | 3 ++- composer.lock | 53 +++++++++++++++++++++++++++++++++++++- src/AntCMS/AntMarkdown.php | 2 ++ 3 files changed, 56 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 27d1ee5..358be04 100644 --- a/composer.json +++ b/composer.json @@ -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": [ { diff --git a/composer.lock b/composer.lock index 7c21877..1c2fd40 100644 --- a/composer.lock +++ b/composer.lock @@ -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", diff --git a/src/AntCMS/AntMarkdown.php b/src/AntCMS/AntMarkdown.php index 9951242..b426c15 100644 --- a/src/AntCMS/AntMarkdown.php +++ b/src/AntCMS/AntMarkdown.php @@ -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);