Skip to content

Commit c5c01ad

Browse files
fix(web): omit underlines on markdown image links
1 parent fa9f936 commit c5c01ad

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

‎apps/web/src/components/ChatMarkdown.tsx‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2943,6 +2943,7 @@ const CHAT_MARKDOWN_COMPONENTS = {
29432943
: null;
29442944
if (!fileLinkMeta) {
29452945
const faviconHost = resolveExternalWebLinkHost(href);
2946+
const hasText = hastHasText(node);
29462947
const pullRequestAutolink = String(
29472948
(props as Record<string, unknown>)["data-pull-request-autolink"] ?? "",
29482949
);
@@ -2974,6 +2975,7 @@ const CHAT_MARKDOWN_COMPONENTS = {
29742975
{...props}
29752976
className={cn(props.className, pullRequestAutolink === "commit" && "font-mono")}
29762977
data-markdown-copy={pullRequestCopy}
2978+
data-markdown-image-link={!hasText || undefined}
29772979
href={href}
29782980
target={isSameDocumentLink ? undefined : "_blank"}
29792981
rel={isSameDocumentLink ? undefined : "noopener noreferrer"}
@@ -3093,7 +3095,7 @@ const CHAT_MARKDOWN_COMPONENTS = {
30933095
});
30943096
}}
30953097
>
3096-
{faviconHost && hastHasText(node) && !isPullRequestAutolink ? (
3098+
{faviconHost && hasText && !isPullRequestAutolink ? (
30973099
<MarkdownExternalLinkContent host={faviconHost} plainText={plainHastText(node)}>
30983100
{linkChildren}
30993101
</MarkdownExternalLinkContent>

‎apps/web/src/index.css‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1895,8 +1895,8 @@ code {
18951895
color: var(--info-foreground);
18961896
}
18971897

1898-
.chat-markdown a:not(.chat-markdown-file-link):hover,
1899-
.chat-markdown a:not(.chat-markdown-file-link):focus-visible {
1898+
.chat-markdown a:not(.chat-markdown-file-link, [data-markdown-image-link]):hover,
1899+
.chat-markdown a:not(.chat-markdown-file-link, [data-markdown-image-link]):focus-visible {
19001900
background-image: radial-gradient(circle, currentcolor 0.75px, transparent 1px);
19011901
background-position: left bottom;
19021902
background-repeat: repeat-x;

0 commit comments

Comments
 (0)