Skip to content

Commit 1f7a651

Browse files
fix: image title (#1137)
1 parent e6140dc commit 1f7a651

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

packages/core/src/renderer/renderer-impl.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,8 @@ export function initRenderer(opts: IOpts = {}): RendererAPI {
296296

297297
image({ href, title, text }: Tokens.Image): string {
298298
const subText = styledContent(`figcaption`, transform(opts.legend!, text, title))
299-
return `<figure><img src="${href}" title="${title}" alt="${text}"/>${subText}</figure>`
299+
const titleAttr = title ? ` title="${title}"` : ``
300+
return `<figure><img src="${href}"${titleAttr} alt="${text}"/>${subText}</figure>`
300301
},
301302

302303
link({ href, title, text, tokens }: Tokens.Link): string {

0 commit comments

Comments
 (0)