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?

  • Melllvar@startrek.website
    link
    fedilink
    English
    arrow-up
    28
    arrow-down
    1
    ·
    3 days ago

    A web page is a combination of a structured document and a separate stylesheet. The same structured document can be styled in radically different ways just by changing the stylesheet. This is how a website can offer different skins, light/dark mode, etc.

    Consider this basic HTML document:

    <html>
       <head><title>Test Page</title></head>
       <body>
          <p>This is a paragraph.</p>
          <ul>
             <li>This is an unordered bullet-point list item</li>
             <li>This is also a list item</li>
          </ul>
       </body>
    </html>
    

    And here’s a stylesheet to make the bullet points square:

    ul {
      list-style-type: square;
    }
    

    Change the stylesheet and you change how the document is rendered. “Reader mode” is just a minimalist stylesheet built into the browser.

    • AwesomeLowlander@sh.itjust.works
      link
      fedilink
      arrow-up
      9
      ·
      3 days ago

      I think OP is asking how the browser figures out what is the important content to display in reader mode and what’s the cruft that can be dropped.