diff --git a/apps/web/src/components/ChatMarkdown.tsx b/apps/web/src/components/ChatMarkdown.tsx index 4c712365475d..c0225713ec4c 100644 --- a/apps/web/src/components/ChatMarkdown.tsx +++ b/apps/web/src/components/ChatMarkdown.tsx @@ -2943,6 +2943,7 @@ const CHAT_MARKDOWN_COMPONENTS = { : null; if (!fileLinkMeta) { const faviconHost = resolveExternalWebLinkHost(href); + const hasText = hastHasText(node); const pullRequestAutolink = String( (props as Record)["data-pull-request-autolink"] ?? "", ); @@ -2974,6 +2975,7 @@ const CHAT_MARKDOWN_COMPONENTS = { {...props} className={cn(props.className, pullRequestAutolink === "commit" && "font-mono")} data-markdown-copy={pullRequestCopy} + data-markdown-image-link={!hasText || undefined} href={href} target={isSameDocumentLink ? undefined : "_blank"} rel={isSameDocumentLink ? undefined : "noopener noreferrer"} @@ -3093,7 +3095,7 @@ const CHAT_MARKDOWN_COMPONENTS = { }); }} > - {faviconHost && hastHasText(node) && !isPullRequestAutolink ? ( + {faviconHost && hasText && !isPullRequestAutolink ? ( {linkChildren} diff --git a/apps/web/src/index.css b/apps/web/src/index.css index b59b8323f8a3..dfdf09af249d 100644 --- a/apps/web/src/index.css +++ b/apps/web/src/index.css @@ -1895,8 +1895,8 @@ code { color: var(--info-foreground); } -.chat-markdown a:not(.chat-markdown-file-link):hover, -.chat-markdown a:not(.chat-markdown-file-link):focus-visible { +.chat-markdown a:not(.chat-markdown-file-link, [data-markdown-image-link]):hover, +.chat-markdown a:not(.chat-markdown-file-link, [data-markdown-image-link]):focus-visible { background-image: radial-gradient(circle, currentcolor 0.75px, transparent 1px); background-position: left bottom; background-repeat: repeat-x;