diff --git a/lib/Text/Dokuwiki/Render/Markdown.pm b/lib/Text/Dokuwiki/Render/Markdown.pm index 9b476bc..3c9df9f 100644 --- a/lib/Text/Dokuwiki/Render/Markdown.pm +++ b/lib/Text/Dokuwiki/Render/Markdown.pm @@ -67,9 +67,10 @@ sub p { sub img { my ($self, $attrs, $content) = @_; - my $title = ($attrs->{title}) ? qq( $attrs->{title}) : ""; + my $title = ($attrs->{title}) ? qq( "$attrs->{title}") : ""; + my $alt = $attrs->{alt} || $attrs->{title} || ''; - return sprintf("![%s](%s%s)", $attrs->{alt} // '', $attrs->{src}, $title); + return sprintf("![%s](%s%s)", $alt, $attrs->{src}, $title); } 1;