diff --git a/package.json b/package.json index 4f685e2..5259677 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "save-my-chatbot", - "version": "3.8.0", + "version": "3.8.2", "license": "RMD-C 1.1", "author": "Hugo COLLIN", "homepage": "https://save.hugocollin.com", diff --git a/public/files/updateNotes.md b/public/files/updateNotes.md index 68a4867..dba74f3 100644 --- a/public/files/updateNotes.md +++ b/public/files/updateNotes.md @@ -1,9 +1,12 @@ # Update notes -# 3.8.0 +# 3.8.2 🚀 Export your threads on Phind 2.0! The Phind interface completely changed, so the extension needed a refresh! Now it's back on tracks! +🧩 Fixing Perplexity export +Newline formatting problem solved! + # 3.7.6 🎯 Fix Perplexity sources list export Some sources were not correctly exported. It's now fixed! diff --git a/src/features/scraper/rules/rules.ts b/src/features/scraper/rules/rules.ts index 9b83dbf..3964a52 100644 --- a/src/features/scraper/rules/rules.ts +++ b/src/features/scraper/rules/rules.ts @@ -3,9 +3,11 @@ import {turndownConverter} from "../../../core/services/format/formatMarkdown"; /* --- Format pre-function --- */ -export function getBlankReplacement(content: any, node: { nodeName: string; getAttribute: (arg0: string) => string; }) { - if (node.nodeName === 'SPAN' && node.getAttribute('class') === 'block mt-md') { - return '\n\n'; +export function getBlankReplacement(content: any, node: HTMLElement) { + // if (node.nodeName === 'SPAN' && node.getAttribute('class') === 'block mt-md') { + if (node.nodeName === 'SPAN') { + if (node.classList.contains('block') && node.classList.contains('mt-md')) return '\n\n'; + if (node.innerHTML === '') return '\n'; } else { return ''; } @@ -88,10 +90,11 @@ export function filter_PreserveLineBreaksInPre_Claude(node: { nodeName: string; } export function replacement_PreserveLineBreaksInPre_Perplexity(content: any, node: { querySelector: (arg0: string) => any; }) { + console.log("replacement_PreserveLineBreaksInPre_Perplexity", node) const codeBlock = node.querySelector('code'); const codeContent = codeBlock.textContent.trim(); const codeLang = codeBlock.parentNode.parentNode.parentNode.querySelector("div").textContent.trim(); - return ('\n```' + codeLang + '\n' + codeContent + '\n```'); + return (turndownConverter.turndown("
") + '\n```' + codeLang + '\n' + codeContent + '\n```'); } export function replacement_preserveLineBreaksInPre_Phind(content: any, node: { querySelector: (arg0: string) => any; }) {