feat: clean HTML fetches with reader mode#1
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
htmlformat unchanged and fall back to the previous whole-document conversion when Readability cannot extract an article.undici@7.28.0so the new dependency set does not introduce the prior undici advisories.Evidence
/Users/yeongyu/local-workspaces/senpi/local-ignore/qa-evidence/20260622-webfetch-reader-mode/pi-webfetch-red.txt/Users/yeongyu/local-workspaces/senpi/local-ignore/qa-evidence/20260622-webfetch-reader-mode/pi-webfetch-green-focused-4.txt/Users/yeongyu/local-workspaces/senpi/local-ignore/qa-evidence/20260622-webfetch-reader-mode/pi-webfetch-test-full-4.txt/Users/yeongyu/local-workspaces/senpi/local-ignore/qa-evidence/20260622-webfetch-reader-mode/pi-webfetch-check-4.txt/Users/yeongyu/local-workspaces/senpi/local-ignore/qa-evidence/20260622-webfetch-reader-mode/pi-webfetch-manual-qa-4.txt/Users/yeongyu/local-workspaces/senpi/local-ignore/qa-evidence/20260622-webfetch-reader-mode/pi-webfetch-manual-cleanup-4.txt/Users/yeongyu/local-workspaces/senpi/local-ignore/qa-evidence/20260622-webfetch-reader-mode/pi-webfetch-audit-prod-2.jsonReviewer approved after verifying the Node engine and text-format coverage fixes.
Summary by cubic
Use reader mode to extract the main article content before converting HTML responses to markdown or text. Raw
htmlresponses remain unchanged, and we fall back to the previous whole-document conversion when no article is detected.New Features
@mozilla/readability+jsdomto strip chrome and convert only the article body; fallback to previous conversion if extraction fails.Dependencies
@mozilla/readability,jsdom, and@types/jsdom.undici@7.28.0and require Node>=20.19.0.Written for commit 749ff2a. Summary will update on new commits.