also removing <style> tags
This commit is contained in:
parent
c24097245b
commit
09d620c294
1 changed files with 3 additions and 1 deletions
|
|
@ -206,7 +206,9 @@ export function htmlBodyToPlainText(htmlString) {
|
|||
|
||||
// remove invisible elements https://stackoverflow.com/questions/39813081/queryselector-where-display-is-not-none
|
||||
// return doc;
|
||||
const docsan=doc.querySelectorAll('[style*="visibility:hidden"]').forEach(e => e.remove());//.querySelector('html').children.not(':visible').remove()
|
||||
doc.querySelectorAll('[style*="display:none"]').forEach(e => e.remove());//.querySelector('html').children.not(':visible').remove()
|
||||
doc.querySelectorAll('style').forEach(e => e.remove());//.querySelector('html').children.not(':visible').remove()
|
||||
|
||||
// Extract text content
|
||||
const textContent = doc.body.textContent || "";
|
||||
// Trim whitespace
|
||||
|
|
|
|||
Loading…
Reference in a new issue