PDF.js supports HTML text fragments
It seems like the PDF.js viewer by mozilla can handle links that contain URI text fragments. Here are some examples:
- https://mozilla.github.io/pdf.js/web/viewer.html#:~:text=Introduction
- https://mozilla.github.io/pdf.js/web/viewer.html#:~:text=Sample program: sieve of Eratosthenes.
Unfortunately, at least on the Mozilla example page, it only seems to work (the “yellow highlighting” appears and is scrolled to) when you navigate to the link while the page is alread loaded. I expect this to be fixable without touching core PDF.js code though (TODO).
Also targets that span multiple lines seem to not be supported, which makes sense but is still disappointing. Example: