kopia lustrzana https://github.com/learn-awesome/learndb
added in special handling for headings in simplifyContent()
rodzic
73443e4ce4
commit
a9a0d26746
|
@ -17,6 +17,8 @@ async function fetchContentFromURL(url) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function simplifyContent(content) {
|
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
|
// Remove script and style elements and their content
|
||||||
let simplifiedContent = content.replace(/<script.*?>.*?<\/script>/gms, '');
|
let simplifiedContent = content.replace(/<script.*?>.*?<\/script>/gms, '');
|
||||||
simplifiedContent = simplifiedContent.replace(/<style.*?>.*?<\/style>/gms, '');
|
simplifiedContent = simplifiedContent.replace(/<style.*?>.*?<\/style>/gms, '');
|
||||||
|
|
Ładowanie…
Reference in New Issue