mirror of
https://github.com/FranP-code/ChatGPT.git
synced 2025-10-13 00:13:25 +00:00
feat: markdown export (#233)
This commit is contained in:
9
src-tauri/src/scripts/export.js
vendored
9
src-tauri/src/scripts/export.js
vendored
@@ -137,7 +137,14 @@ function addActionsButtons(actionsArea, TryAgainButton) {
|
||||
}
|
||||
|
||||
async function exportMarkdown() {
|
||||
const data = ExportMD.turndown(document.querySelector("main div>div>div").innerHTML);
|
||||
const content = Array.from(document.querySelectorAll("main >div>div>div>div")).map(i => {
|
||||
let j = i.cloneNode(true);
|
||||
if (/dark\:bg-gray-800/.test(i.getAttribute('class'))) {
|
||||
j.innerHTML = `<blockquote>${i.innerHTML}</blockquote>`;
|
||||
}
|
||||
return j.innerHTML;
|
||||
}).join('<hr />');
|
||||
const data = ExportMD.turndown(content);
|
||||
const { id, filename } = getName();
|
||||
await invoke('save_file', { name: `notes/${id}.md`, content: data });
|
||||
await invoke('download_list', { pathname: 'chat.notes.json', filename, id, dir: 'notes' });
|
||||
|
||||
Reference in New Issue
Block a user