I tried googling and I got a lot of hits for what reader mode does and how to enable it, but nobody can explain what the browser is actually doing.

Do sites have pared-down versions of their pages specifically for reader mode? Or does the browser just scan for particular HTML tags?

  • brisk@aussie.zone
    link
    fedilink
    arrow-up
    15
    ·
    8 days ago

    If it helps there’s a standalone version of the logic.

    At a rough scan, it looks like it tries to find a best guess “main content” node by stripping unlikely nodes and then scoring each node. Element type and content contribute to the score

    /**
           * Loop through all paragraphs, and assign a score to them based on how content-y they look.
           * Then add their score to their parent node.
           *
           * A score is determined by things like number of commas, class names, etc. Maybe eventually link density.
           **/