Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Short sentence standalone paragraphs missing from reader view of https://www.royalroad.com/fiction/63759/super-supportive/chapter/1449598/one-hundred-two-what-kind-of-wordchain #861

Closed
jaredhirsch opened this issue Apr 15, 2024 · 2 comments · Fixed by #867

Comments

@jaredhirsch
Copy link
Member

As described in https://bugzilla.mozilla.org/show_bug.cgi?id=1890310, this page contains a number of very short paragraphs (one or a few words) that are lost in reader view, even though most of the content is correctly displayed.

It's worth noting that this website's design is to wrap each paragraph's content in <div><div><span>, with inline styles applied to all three elements, rather than just putting the content in sibling <p> elements. So the page structure looks like a few hundred blocks like this:

<div style="margin: 1em 0; caret-color: #000000">
  <div style="direction: ltr">
    <span style="font-family: arial, sans-serif">Some content here</span>
  </div>
</div>

Some examples of missed content:

  • Alden stared at it.
  • “Let me think about it.”
  • “Gotcha.”

Slightly longer sentences not dropped from reader view:

  • “I was thinking the same thing.”
  • “That’s very efficient,” said Alden.
@cmkm
Copy link

cmkm commented Apr 19, 2024

One potential fix might be to add chapter to the positive regex.

@inhumantsar
Copy link
Contributor

adding chapter to the positive regex didn't help. looks like these short paragraphs are being filtered by _cleanConditionally:

 Reader: (Readability) Removing node: !isList && headingDensity < 0.9 && contentLength < 25 && (img === 0 || img > 2) && !this._hasAncestorTag(node, 'figure') (headingDensity=0, contentLength=9, img=0)

adding && linkDensity > 0 to that check lets them through though. seeing 221 child elements in the expected output vs 222 in the source, with the 1 missing element being an empty div. this does affect a number of test cases, but they seem manageable so far. i'll open PR (at least a draft) for this shortly.

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

Successfully merging a pull request may close this issue.

3 participants