Skip to content

Commit b8a5ee4

Browse files
authored
Fix: correctly adding newlines in Perplexity extracted content (#259)
* fix: correctly targeting Perplexity newlines * 3.8.1 * fix: correctly adding newline between list item and code block * 3.8.2
1 parent 3e2cf6b commit b8a5ee4

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "save-my-chatbot",
3-
"version": "3.8.0",
3+
"version": "3.8.2",
44
"license": "RMD-C 1.1",
55
"author": "Hugo COLLIN",
66
"homepage": "https://save.hugocollin.com",

public/files/updateNotes.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
# Update notes
2-
# 3.8.0
2+
# 3.8.2
33
🚀 Export your threads on Phind 2.0!
44
The Phind interface completely changed, so the extension needed a refresh!
55
Now it's back on tracks!
66

7+
🧩 Fixing Perplexity export
8+
Newline formatting problem solved!
9+
710
# 3.7.6
811
🎯 Fix Perplexity sources list export
912
Some sources were not correctly exported. It's now fixed!

src/features/scraper/rules/rules.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@ import {turndownConverter} from "../../../core/services/format/formatMarkdown";
33
/*
44
--- Format pre-function ---
55
*/
6-
export function getBlankReplacement(content: any, node: { nodeName: string; getAttribute: (arg0: string) => string; }) {
7-
if (node.nodeName === 'SPAN' && node.getAttribute('class') === 'block mt-md') {
8-
return '\n\n';
6+
export function getBlankReplacement(content: any, node: HTMLElement) {
7+
// if (node.nodeName === 'SPAN' && node.getAttribute('class') === 'block mt-md') {
8+
if (node.nodeName === 'SPAN') {
9+
if (node.classList.contains('block') && node.classList.contains('mt-md')) return '\n\n';
10+
if (node.innerHTML === '') return '\n';
911
} else {
1012
return '';
1113
}
@@ -88,10 +90,11 @@ export function filter_PreserveLineBreaksInPre_Claude(node: { nodeName: string;
8890
}
8991

9092
export function replacement_PreserveLineBreaksInPre_Perplexity(content: any, node: { querySelector: (arg0: string) => any; }) {
93+
console.log("replacement_PreserveLineBreaksInPre_Perplexity", node)
9194
const codeBlock = node.querySelector('code');
9295
const codeContent = codeBlock.textContent.trim();
9396
const codeLang = codeBlock.parentNode.parentNode.parentNode.querySelector("div").textContent.trim();
94-
return ('\n```' + codeLang + '\n' + codeContent + '\n```');
97+
return (turndownConverter.turndown("<br>") + '\n```' + codeLang + '\n' + codeContent + '\n```');
9598
}
9699

97100
export function replacement_preserveLineBreaksInPre_Phind(content: any, node: { querySelector: (arg0: string) => any; }) {

0 commit comments

Comments
 (0)