DSH Markdown Copy: Copy selected session content as editable Markdown source code
drinkerqvb/dsh-markdown-copy is a DSH client plugin. It reads the selection during the browser's copy event capture phase. When the selection falls completely within the chat flow ([data-chat-flow]), it traverses the selected DOM to regenerate Markdown (including headings, lists, code blocks, GFM tables, bold/italic/strikethrough, links, and KaTeX formulas), overwriting `text/plain` so that pasting into the editor produces editable source code rather than rendered plain text. The plugin only handles copying within the chat flow and leaves input boxes unaffected. It outputs cross-message content in document order. Selections inside tables or code blocks expand to the entire block, while inline elements restore markers via the ancestor chain. The principle is rendering equivalence rather than byte-by-byte restoration; use the message's built-in copy button if raw bytes are required. Installation command: `dsh plugin add https://github.com/DrinkerqvB/dsh-markdown-copy`. It becomes effective after refreshing the session page. Version 0.1.1, MIT License. Known limitations include the inability to restore byte-by-byte, partial selections extending to the entire block, and the absence of original HTML output.
Read More