Fix #1012: Prevent aggressive stripping of below/bellow header content wrappers#1015
Open
hanumanraj07 wants to merge 1 commit into
Open
Fix #1012: Prevent aggressive stripping of below/bellow header content wrappers#1015hanumanraj07 wants to merge 1 commit into
hanumanraj07 wants to merge 1 commit into
Conversation
gijsk
requested changes
Jul 9, 2026
gijsk
left a comment
Contributor
There was a problem hiding this comment.
Thanks for the PR.
Unfortunately, it doesn't seem reasonable to treat "below" as semantically indicating "this is important article text" - even worse for "bellow".
Is there no other markup that can be used to make this determination? And/or, is there evidence that this class name structure is common for other sites than knowablemagazine.org, due to common CMSes or similar?
Also, please add a testcase to the testcases folder for this so we don't regress it in future - you can use the generate-testcase.js script to do this easily.
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.
Fixes #1012
Description
Currently, Readability fails to parse articles on sites like
knowablemagazine.orgwhere the main content is wrapped inside a container with a class such asbellowheadercontainer.The
unlikelyCandidatesregex aggressively strips out elements containing the wordheaderwithout checking for word boundaries. As a result, structural containers using class names likebelow-headerorbellowheaderare prematurely removed from the DOM, causing Readability to completely miss the main article content and fallback to parsing unrelated footer elements.This PR adds
belowand its common typobellowto theokMaybeItsACandidatesafeguard regex. This ensures that classes indicating placement beneath a header (which frequently wrap the main article content) bypass theunlikelyCandidatespurge and receive a proper chance to be scored.Testing
okMaybeItsACandidatecorrectly safeguards the article container to resolve the parsing failure in knowablemagazine.org - Does not show the article, republish message displayed after enabling reader mode #1012.