I have a similar project for speed-reading in the terminal: https://github.com/0hAodha/ogma
It works on plaintext, but you can define pre-processing hooks to convert, e.g., a PDF or webpage into readable content using the config file.
I have a similar project for speed-reading in the terminal: https://github.com/0hAodha/ogma
It works on plaintext, but you can define pre-processing hooks to convert, e.g., a PDF or webpage into readable content using the config file.
Oh nice, the pre-processing hooks are a way cleaner way of solving the format issue than I was doing. When you are on the terminal you can shell out to pdftotext or pandoc and people use the format convertor that they already know and trust. But when you are writing stuff for the browser you have to include the format convertors in the download so I was including pdf.js, JSZip and mammoth in the build and still could not handle formats that I had not seen.
Your method also nicely solves that thing that I keep on getting asked for which is copy and paste a url and have it fetch the article and display the text. I had somebody email me about that today! On the terminal you just get something like: curl some_url | readable and you are pretty much done. On the browser it's a cross origin request so you will want to include a server that fetchies it and well that would kinda be missing the point of having local rendering.
Something that i was wondering is if monospaced text would have made it easier for you to find the alignment for the pivot? Fixed-width is simple, since your optimal offset is just a character offset. For proportional text i'm just taking my best effort pivot character and anchoring it, and then extending word fragments from that point in both directions. Otherwise the words can tend to wander as you eye flows from character to character.
[dead]