You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(ui): add copy format options -- Markdown and Email-ready HTML #18967
The current copy button on assistant messages copies raw text via navigator.clipboard.writeText(). This works, but when pasting into Gmail, Slack, or docs the formatting is lost. The raw markdown renders as plain text.
I'd like to add format options to the existing copy button. Two additional modes alongside the current behavior:
Copy Markdown -- puts the raw markdown on the clipboard as text/plain with the content type that markdown-aware apps (Notion, Obsidian, GitHub) can render. This is close to what exists today but explicitly signals the format.
Copy for Email -- converts the markdown to sanitized HTML and puts it on the clipboard via navigator.clipboard.write() with text/html MIME type. Gmail, Outlook, and Apple Mail render this correctly. The HTML gets inline styles (no external CSS dependencies): monospace code blocks, bordered tables, styled blockquotes, blue links. Wrapped in Arial 14px to match Gmail's default.
I've built this pattern in another project and it works well. The sanitization strips all classes/styles from the rendered HTML and inlines email-safe CSS on key elements (code, pre, blockquote, table, th/td, a).
Implementation approach: Replace the single IconButton with a DropdownMenu (already exists in packages/ui/src/components/dropdown-menu.tsx). Three menu items: Copy Text (current), Copy Markdown, Copy for Email. The trigger is the existing copy icon.
The change is scoped to packages/ui/src/components/message-part.tsx -- the handleCopy function and the JSX around the copy button. No API changes.
Activity
github-actions commentedon Mar 24, 2026
This issue doesn't fully meet our contributing guidelines.
What needs to be fixed:
[FEATURE]:as required by the feature request template.Please edit this issue to address the above within 2 hours, or it will be automatically closed.
This issue might be a duplicate of existing issues. Please check:
If you believe this was flagged incorrectly, please let a maintainer know.
andrewdunndev commentedon Mar 24, 2026
Closing as duplicate of #14041 (copy as markdown) and #10693 (copy as rich text). I'll comment on those with an implementation offer.