Created
April 3, 2023 19:44
-
-
Save NostraDavid/fed9ea8126d7cf8fea0b1778f7367ac8 to your computer and use it in GitHub Desktop.
Save this as a bookmark. Go to a ChatGPT chat. Click the bookmark to export the file, with the UUID and Chat Title in the filename
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript: (() => {let output = "";const es = document.querySelectorAll("[class*='min-h-[20px]']");const today = `${new Date().toISOString().slice(0, 19)}Z`;output += `---\ndate: "${today}"\n---\n#\n%60;for (let i = 0; i < es.length; i++) {const first = es[i].firstChild;if (!first) continue;if (first.nodeType === Node.TEXT_NODE) {let lines = first.textContent.split("\n"); for (let i = 0; i < lines.length; i++) {const line = lines[i];output += %60\n> ${line}%60;}output += %60\n%60;}if (first.nodeType === Node.ELEMENT_NODE) {const childNodes = first.childNodes;for (let j = 0; j < childNodes.length; j++) {const childNode = childNodes[j];if (childNode.nodeType === Node.ELEMENT_NODE) {let tagName = childNode.tagName;let textContent = childNode.textContent;switch (tagName) {case "P":output += %60\n${textContent}%60;break;case "OL":output += %60\n%60;childNode.childNodes.forEach((el, index) => {if (el.nodeType === Node.ELEMENT_NODE && el.tagName === "LI") {output += %60${index + 1}. ${el.textContent}\n%60;}});break;case "UL":output += %60\n%60;childNode.childNodes.forEach((el) => {if (el.nodeType === Node.ELEMENT_NODE && el.tagName === "LI") {output += %60* ${el.textContent}\n%60;}});break;case "PRE":output += %60\n\%60\%60\%60${textContent}\%60\%60\%60%60;break;}output += %60\n%60;}}}}output = output.replace(/Copy code/g, %60\n%60);output = output.replace(/\n\n\n/g, %60\n\n%60);console.save = (data, filename) => {const blob = new Blob([data], { type: "text/markdown" });const link = document.createElement("a");link.download = filename;link.href = window.URL.createObjectURL(blob);link.dataset.downloadurl = ["text/markdown", link.download, link.href].join(":");const evt = new MouseEvent("click", {canBubble: true,cancelable: false,view: window,detail: 0,screenX: 0,screenY: 0,clientX: 0,clientY: 0,ctrlKey: false,altKey: false,shiftKey: false,metaKey: false,button: 0,relatedTarget: null,});link.dispatchEvent(evt);};console.save(output,%60${window.location.href.split("/").pop()} - ${document.title}.md%60);})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment