Skip to content

Fix #1012: Prevent aggressive stripping of below/bellow header content wrappers#1015

Open
hanumanraj07 wants to merge 1 commit into
mozilla:mainfrom
hanumanraj07:main
Open

Fix #1012: Prevent aggressive stripping of below/bellow header content wrappers#1015
hanumanraj07 wants to merge 1 commit into
mozilla:mainfrom
hanumanraj07:main

Conversation

@hanumanraj07

Copy link
Copy Markdown

Fixes #1012

Description
Currently, Readability fails to parse articles on sites like knowablemagazine.org where the main content is wrapped inside a container with a class such as bellowheadercontainer.

The unlikelyCandidates regex aggressively strips out elements containing the word header without checking for word boundaries. As a result, structural containers using class names like below-header or bellowheader are prematurely removed from the DOM, causing Readability to completely miss the main article content and fallback to parsing unrelated footer elements.

This PR adds below and its common typo bellow to the okMaybeItsACandidate safeguard regex. This ensures that classes indicating placement beneath a header (which frequently wrap the main article content) bypass the unlikelyCandidates purge and receive a proper chance to be scored.

Testing

@hanumanraj07 hanumanraj07 changed the title Fix #1012: Prevent aggressive stripping of below/bellow header content wrappers This PR: Prevent aggressive stripping of below/bellow header content wrappers Jul 7, 2026
@hanumanraj07 hanumanraj07 changed the title This PR: Prevent aggressive stripping of below/bellow header content wrappers Fix #1012: Prevent aggressive stripping of below/bellow header content wrappers Jul 8, 2026

@gijsk gijsk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

knowablemagazine.org - Does not show the article, republish message displayed after enabling reader mode

2 participants