fix alt for images

This commit is contained in:
Valeriu 2021-04-17 16:34:31 +03:00
parent ab274cf58f
commit d793b9d021
1 changed files with 6 additions and 3 deletions

View File

@ -1414,6 +1414,8 @@ class Parsedown
return;
}
$alt = $Link['element']['handler']['argument'] == 'enter image description here' ? '' : $Link['element']['handler']['argument'];
$Inline = array(
'extent' => $Link['extent'] + 1,
'element' => array(
@ -1422,14 +1424,15 @@ class Parsedown
'class' => 'mb-6',
'loading' => 'lazy',
'src' => $Link['element']['attributes']['href'],
'alt' => $Link['element']['handler']['argument'],
'alt' => $alt,
),
'autobreak' => true,
),
);
if ($Inline['element']['attributes']['alt']) {
$Inline['element']['attributes']['title'] = $Inline['element']['attributes']['alt'];
if ($alt) {
$Inline['element']['attributes']['title'] = $alt;
}
unset($alt);
$Inline['element']['attributes'] += $Link['element']['attributes'];