copy button on every code block

the bubble's copy button copies the whole reply, which is the wrong unit when
the reply is prose ending in one command to run. fenced blocks get their own
button; inline code doesn't. text read from textContent at click time rather
than the markdown ast, trailing newline stripped so a pasted command doesn't
run itself. the positioned wrapper takes the vertical margin, or the pre's own
margin collapses through it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-07 01:22:57 +00:00
co-authored by Claude Opus 5
parent 29fc9722c1
commit 6a682fae98
4 changed files with 101 additions and 1 deletions
+10
View File
@@ -130,6 +130,16 @@
font-family: ui-monospace, monospace;
}
/* A fenced block is wrapped so its copy button has something to position against. The wrapper carries
the spacing, or the pre's own margin would collapse through it and defeat the first/last-child reset. */
.chat-md .chat-code {
margin: 0.75em 0;
}
.chat-md .chat-code pre {
margin: 0;
}
.chat-md pre {
margin: 0.75em 0;
padding: 0.75em 1em;