javascript:(()=>{let s=x=>x.replace(/([^\\]|^)\n/,'$1 \n').replace('<','<').replace('>','>'),f=e=>(({'#text':e=>s(e.textContent),DIV:g('\n\n'),P:g(''),OL:e=>[...e.childNodes].map((x,i)=>`${i+(e.start??1)}. ${f(x).replace(/\n/,'\n '+' '.repeat(`${i}`.length))}`).join('\n'),UL:e=>[...e.childNodes].map(x=>`- ${f(x).replace(/\n/,'\n ')}`).join('\n'),LI:g(''),TABLE:e=>`|${[...e.querySelectorAll('thead th')].map(f).join('|')}|\n|${[...e.querySelectorAll('thead th')].map(x=>'---').join('|')}|\n`+[...e.querySelectorAll('tbody tr')].map(x=>`|${[...x.children].map(g('')).join('|')}|`).join('\n'),PRE:e=>'```'+e.querySelector('.hljs').className.replace(/^.*language-(\S+).*$/,'$1')+'\n'+e.querySelector('.hljs').innerText.replace(/([^\n])$/,'$1\n')+'```',CODE:e=>'`'+e.innerText+'`',STRONG:e=>`**${g('')(e)}**`,EM:e=>`_${g('')(e)}_`,DEL:e=>`<del>${g('')(e)}</del>`,IMG:e=>``})[e.nodeName]??(e=>s(e.innerText)))(e),g=j=>e=>[...e.childNodes].map(f).join(j),h=[...document.querySelectorAll('.group.w-full')].map(e=>`[__${e.classList.contains('bg-gray-50')?'Assistant':'User'}__]\n${g('\n\n')(e.querySelector('.whitespace-pre-wrap'))}`).join('\n\n');console.log(h);navigator.clipboard.writeText(h).then(()=>alert("copied!")).catch(alert)})()
-
Make a bookmark using above text as URL.
-
Open your chat page in ChatGPT web interface.
-
Open your bookmarklet.
-
Paste your clipboard to wherever you want.