Skip to content

Commit

Permalink
Update apps/converter/htmlToMarkdown.js
Browse files Browse the repository at this point in the history
Co-authored-by: Dan Lemon <[email protected]>
  • Loading branch information
dspachos and dan2k3k4 authored Nov 26, 2024
1 parent d796bc2 commit caf3b08
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions apps/converter/htmlToMarkdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,7 @@ async function extractMainContent(htmlString) {
// Create a new JSDOM instance and parse the HTML string
const dom = new JSDOM(html);
// Extract the <main> element content
let mainElement = dom.window.document.querySelector('main');
if (!mainElement) {
mainElement = dom.window.document.querySelector('article');
}
const mainElement = dom.window.document.querySelector('main, article');
// Return the inner HTML of the <main> tag, or an empty string if not found
return mainElement ? mainElement.innerHTML : '';
}
Expand Down

0 comments on commit caf3b08

Please sign in to comment.