Tampermonkey userscript to add buttons to https://chat.openai.com, converting the conversation and research reports into Markdown and either copying to clipboard or saving as private GitHub Gists.
In early May 2025, ChatGPT updated its interface and appears to have broken the built-in Markdown copying functionality. While ChatGPT does provide buttons to copy content, links are now stripped from the copied Markdown, severely reducing the usefulness of research reports and conversations with citations.
This script:
- Restores proper Markdown export with all links and formatting intact
- Adds clipboard copying for immediate use of complete Markdown
- Provides Gist export (which was never available natively)
For anyone who needs to preserve the full value of ChatGPT's outputs including all links and citations, this script provides a simple solution.
- Install Tampermonkey in your browser.
- Click its toolbar icon → Create a new script → paste the contents of
tampermonkey_script.js
(this repo) → Save. - Refresh any open ChatGPT tab; share buttons will appear in the chat interface.
The Copy buttons work immediately without any setup and don't require GitHub authentication.
For the Gist functionality, the first time you press any Gist button, the script will prompt for a GitHub Personal‑Access Token (PAT):
- Visit https://github.com/settings/tokens/new?scopes=gist&description=ChatGPTShare
- Tick the "gist" scope (✱the only permission required✱).
- Generate, copy, and paste the token into the prompt.
- The token is stored locally via Tampermonkey's
GM_setValue
; never sent anywhere except GitHub.
You can update/clear the PAT later via Tampermonkey's Storage panel or by running localStorage.removeItem('github_pat')
in DevTools.
The script adds two buttons to the chat interface that export the entire conversation:
- Chat as usual on ChatGPT.
- Two buttons are available at the bottom of the chat:
- Copy (blue): Copies the conversation as Markdown to your clipboard.
- A status banner appears ("Preparing markdown…").
- The formatted Markdown is copied to your clipboard for immediate use.
- Gist (green): Saves the conversation as a GitHub Gist.
- A status banner appears ("Preparing… → Uploading…").
- A new tab opens with your private Gist containing
chatgpt_conversation.md
.
- Copy (blue): Copies the conversation as Markdown to your clipboard.
When ChatGPT generates "deep research" reports, the script adds dedicated buttons at the top and bottom of each research report:
- Hover over any research report section to see the buttons.
- Two buttons are available at both the top and bottom of research reports:
- Copy (blue): Copies just that research report as Markdown to your clipboard.
- A status banner appears ("Preparing research report…").
- The formatted research report Markdown is copied to your clipboard.
- Share (green): Saves the research report as a GitHub Gist.
- A status banner appears ("Preparing research report… → Uploading…").
- A new tab opens with a private Gist containing just that research report.
- Copy (blue): Copies just that research report as Markdown to your clipboard.
The Markdown format for full conversations mirrors:
# ChatGPT Conversation
## 🧑 User
…
---
## 🤖 Assistant
…
---
For research reports, the format is:
# ChatGPT Research Report
[Content of the research report with formatting and links preserved]
When using the Copy button, you can immediately paste the Markdown anywhere you need it.
When using the Gist functionality, you can use GitHub's Download ZIP or Raw to retrieve the file, or share the Gist URL.
- Copy buttons: No data is sent anywhere. The Markdown is copied directly to your clipboard within your browser.
- Gist buttons: Data is sent only to GitHub, and only after you explicitly press a Gist button.
The script runs entirely in‑browser, scraping the DOM you can already see.
In tampermonkey_script.js
change public: false
to true
inside uploadGist()
.
See scrapeConversation()
in the userscript for full conversations and scrapeResearchReport()
for individual research reports. The script identifies messages using data attributes in the ChatGPT DOM and handles special formatting like citation links.
- Copy Button (blue): Instantly copies the Markdown to your clipboard without requiring GitHub authentication.
- Gist Button (green): Exports the content to a private GitHub Gist (requires GitHub PAT).
- Research Report Buttons: Small buttons that appear at the top and bottom of research reports, allowing you to copy or share just that specific research section without the rest of the conversation.
Disable the userscript from Tampermonkey or simply delete it. Stored PATs can be purged via Tampermonkey's Storage tab.