Skip to content

Instantly share code, notes, and snippets.

@Kompas
Kompas / chatgpt-conversation-exporter.js
Created January 7, 2026 19:41 — forked from LukasMFR/chatgpt-conversation-exporter.js
JavaScript snippet to export a ChatGPT conversation from the web UI to a clean Markdown file, with correct user/assistant attribution, code block preservation, and basic media placeholders. Designed to be run directly in the browser console (Safari/Chrome/Firefox).
(() => {
function formatDate(date = new Date()) {
return date.toISOString().split("T")[0];
}
function escapeMarkdown(text) {
return text
.replace(/\\/g, "\\\\")
.replace(/\*/g, "\\*")
.replace(/_/g, "\\_")