1
0
mirror of https://github.com/erusev/parsedown.git synced 2023-08-10 21:13:06 +03:00

lazy loading for images

This commit is contained in:
Valeriu 2021-04-02 20:45:29 +03:00
parent 18eac15b36
commit 2d19715a1d

View File

@ -1415,12 +1415,16 @@ class Parsedown
'name' => 'img',
'attributes' => array(
'class' => 'mb-6',
'loading' => 'lazy',
'src' => $Link['element']['attributes']['href'],
'alt' => $Link['element']['handler']['argument'],
),
'autobreak' => true,
),
);
if ($Inline['element']['attributes']['alt']) {
$Inline['element']['attributes']['title'] = $Inline['element']['attributes']['alt'];
}
$Inline['element']['attributes'] += $Link['element']['attributes'];