Skip to content

Commit

Permalink
fix: removing node with background image
Browse files Browse the repository at this point in the history
  • Loading branch information
sywhb committed Jun 26, 2023
1 parent 43dcb8d commit 244fb4c
Show file tree
Hide file tree
Showing 6 changed files with 1,327 additions and 4 deletions.
4 changes: 2 additions & 2 deletions packages/puppeteer-parse/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -724,10 +724,10 @@ async function retrieveHtml(page, logRecord) {
// Replacing element only of there are no content inside, b/c might remove important div with content.
// Article example: http://www.josiahzayner.com/2017/01/genetic-designer-part-i.html
// DIV with class "content-inner" has `url("https://resources.blogblog.com/blogblog/data/1kt/travel/bg_container.png")` background image.
if (el.innerHTML.length < 25) {
if (!el.textContent) {
const img = document.createElement('img');
img.src = matchedSRC[1];
el && el.parentNode && el.parentNode.removeChild(el);
el && el.parentNode && el.parentNode.replaceChild(img, el);
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions packages/readabilityjs/test/generate-testcase.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,10 +186,10 @@ async function fetchSource(url, callbackFn) {
// Replacing element only of there are no content inside, b/c might remove important div with content.
// Article example: http://www.josiahzayner.com/2017/01/genetic-designer-part-i.html
// DIV with class "content-inner" has `url("https://resources.blogblog.com/blogblog/data/1kt/travel/bg_container.png")` background image.
if (el.innerHTML.length < 25) {
if (!el.textContent) {
const img = document.createElement('img');
img.src = matchedSRC[1];
el && el.parentNode && el.parentNode.removeChild(el);
el && el.parentNode && el.parentNode.replaceChild(img, el);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"title": "Digital Garden Overview",
"byline": null,
"dir": null,
"excerpt": "The Obsidian Digital Garden Plugin is a free and open source publishing tool for Obsidian.",
"siteName": "fakehost",
"siteIcon": "http://fakehost/favicon.ico",
"publishedDate": null,
"language": "English",
"readerable": false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<DIV class="page" id="readability-page-1">
<DIV>
<header>
</header>
<h2> 🏡 </h2>
<h2 tabindex="-1" id="obsidian-digital-garden"> Obsidian Digital Garden </h2>
<p> The <a href="https://github.com/oleeskild/obsidian-digital-garden" target="_blank">Obsidian Digital Garden Plugin</a> is a free and open source publishing tool for <a href="https://obsidian.md/" target="_blank">Obsidian</a>. </p>
<p> Publish your notes directly from <a href="https://obsidian.md/" target="_blank">Obsidian</a> to the internet. While <a href="http://fakehost/features/">feature packed</a>, it is <a href="http://fakehost/getting-started/03-note-settings/">highly configurable</a> and <a href="http://fakehost/advanced/adding-custom-components/">hackable</a>. Enable and disable features on a per-note basis. Use it as a full fledged digital garden or as a <a href="http://fakehost/example-pages/simple-page/">simple note sharing solution</a>. </p>
<p> 👉 <a href="http://fakehost/getting-started/01-getting-started/">Getting Started</a><br> 👉 <a href="http://fakehost/features/">Features</a>
</p>
<h2 id="examples" tabindex="-1"> Examples </h2>
<p> This site is itself powered by the Digital Garden plugin. </p>
<div>
<div>
<p><img src="https://res.cloudinary.com/dix4ngy25/image/upload/c_scale,r_8,w_300/v1668690350/dgdocs/CleanShot_2022-11-17_at_14.05.20_2x.png"> <a href="https://edav-garden.netlify.app/" target="_blank">Edav Garden</a>
</p>
</div>
<div>
<p><img src="https://res.cloudinary.com/dix4ngy25/image/upload/c_scale,r_8,w_300/v1668500110/dgdocs/CleanShot_2022-11-15_at_09.14.26_2x.png"> <a href="https://ajy.co/" target="_blank">ajy.co</a>
</p>
</div>
<div>
<p><img src="https://res.cloudinary.com/dix4ngy25/image/upload/c_scale,r_8,w_300/v1672992556/dgdocs/CleanShot_2023-02-05_at_20.18.45_2x"> <a href="https://hermitage.utsob.me/" target="_blank">Hermitage</a>
</p>
</div>
<div>
<p><img src="https://res.cloudinary.com/dix4ngy25/image/upload/c_scale,r_8,w_300/v1668068263/dgdocs/CleanShot_2022-11-10_at_09.17.28_2x.png"> <a href="https://notes.thatother.dev/" target="_blank">That Other Dev</a>
</p>
</div>
<div>
<p><img src="https://res.cloudinary.com/dix4ngy25/image/upload/c_scale,r_8,w_300/v1668500118/dgdocs/CleanShot_2022-11-15_at_09.14.17_2x.png"> <a href="https://razvan-andrei-surdu.eu/" target="_blank">Razvan Andrei Surdu</a>
</p>
</div>
<div>
<p><img src="https://res.cloudinary.com/dix4ngy25/image/upload/c_scale,r_8,w_300/v1668068103/dgdocs/CleanShot_2023-02-05_at_20.17.02_2x"> <a href="https://icewind.quest/" target="_blank">IceWind.Quest</a>
</p>
</div>
<div>
<p><img src="https://res.cloudinary.com/dix4ngy25/image/upload/c_scale,r_8,w_300/v1668068358/dgdocs/CleanShot_2022-11-10_at_09.19.06_2x.png"> <a href="https://notes.hxhc.xyz/" target="_blank">hxhc</a>
</p>
</div>
<div>
<p><img src="https://res.cloudinary.com/dix4ngy25/image/upload/c_scale,r_8,w_300/v1671387169/dgdocs/CleanShot_2022-12-18_at_19.12.28_2x.png"> <a href="https://notes.ole.dev/" target="_blank">notes.ole.dev</a>
</p>
</div>
</div>
<div>
<p><a href="https://github.com/oleeskild/obsidian-digital-garden/issues/55" target="_blank"><button>Submit your site</button></a>
</p>
</div>
</DIV>
</DIV>
Loading

0 comments on commit 244fb4c

Please sign in to comment.