agent-shell icon indicating copy to clipboard operation
agent-shell copied to clipboard

Feature request: Copy raw markdown (not rendered text) from agent buffers

Open liaowang11 opened this issue 5 months ago • 4 comments

I know this can be hard for agent-shell-markdown-replace-markup but couldn't resist to ask. When I select a region in an agent buffer and copy it, I'd like to get the raw markdown (# Title, _italic_, `code`) rather than the rendered text.

Today, with the default in-place renderer (agent-shell-markdown-replace-markup), inline markup is deleted from the buffer at render time, so copying can only ever yield the stripped/rendered text — the original markdown isn't recoverable. Tables already preserve their source via the agent-shell-markdown-table-source text property and round-trip through copy/save, so there's a precedent.

Use case: pasting an agent's reply back into a markdown doc, issue, or another chat, where I want the formatting markers preserved.

Checklist

  • [x] I agree to communicate with the author myself (not AI-generated).
  • [x] I've read the README's Filing issues section.
  • [x] I'm running the latest versions (fill in below).
    • agent-shell version: 0.55.1
    • acp.el version: 0.12.2
    • ACP package version: pi-agent-acp
    • Agent CLI version: n/a — feature request about rendering, agent-agnostic

liaowang11 avatar Jun 11 '26 14:06 liaowang11

lol some users don't want markup when they copy and some do. I'm doomed either way ;-)

With the new renderer we will actually have more flexibility. As you saw, we store metadata in the rendered text, so we can use it to convert to any other markup (including org and markdown).

xenodium avatar Jun 11 '26 18:06 xenodium

https://github.com/xenodium/agent-shell/commit/891e8dc74712ff4afad1e9ba4c14cd62a2c18fa1 adds M-x agent-shell-copy-as-markdown, which should enable selecting any region and copying as markdown.

xenodium avatar Jul 05 '26 21:07 xenodium

I tried it, it's working perfectly, thanks for your work.

liaowang11 avatar Jul 06 '26 02:07 liaowang11

Thanks for reporting back!

xenodium avatar Jul 06 '26 06:07 xenodium