added in special handling for headings in simplifyContent()

pull/73/head
Huda Joad 2023-11-25 00:26:54 +03:00
rodzic 73443e4ce4
commit a9a0d26746
1 zmienionych plików z 2 dodań i 0 usunięć

Wyświetl plik

@ -17,6 +17,8 @@ async function fetchContentFromURL(url) {
}
function simplifyContent(content) {
// Denote headings with a marker (like '###') and add a line break
content = content.replace(/<h[1-6].*?>(.*?)<\/h[1-6]>/g, '\n### $1\n');
// Remove script and style elements and their content
let simplifiedContent = content.replace(/<script.*?>.*?<\/script>/gms, '');
simplifiedContent = simplifiedContent.replace(/<style.*?>.*?<\/style>/gms, '');