Skip to content

The agent that grows with you

fix(desktop): unwrap URL references copied from code blocks

Denis H5a3cc0b5a53f
diff --git a/apps/desktop/src/components/chat/shiki-highlighter.tsx b/apps/desktop/src/components/chat/shiki-highlighter.tsx
index c9782c22d3e..cbdb2ed55c7 100644
--- a/apps/desktop/src/components/chat/shiki-highlighter.tsx
+++ b/apps/desktop/src/components/chat/shiki-highlighter.tsx
@@ -125,6 +125,11 @@ const PlainCode: FC<{ code: string }> = ({ code }) => {
)
}
+/** Convert URL references back to the literal URL for code-block clipboard text. */
+export function copyableCodeText(code: string): string {
+ return code.replaceAll('@url:', '')
+}
+
export const SyntaxHighlighter: FC<HermesSyntaxHighlighterProps> = ({
components: { Pre },
language,
@@ -155,7 +160,7 @@ export const SyntaxHighlighter: FC<HermesSyntaxHighlighterProps> = ({
iconClassName="size-3"
label={t.assistant.tool.copyCode}
showLabel={false}
- text={content}
+ text={copyableCodeText(content)}
/>
<CodeCardBody className="[&_pre]:px-3 [&_pre]:py-2.5">
<ExpandableBlock>