I'm currently adjusting the code shown in Test if a paragraph has a page break in it?
to support underlining and highlighting using TikZ similar as shown in Cool Text Highlighting in LaTeX, but without the need of soul or any other package which influences the typesetting of the text.
For this I'm placing a TikZ coordinate (using overlay,remember picture) at the begin and end and use this to draw the lines. At the moment I simply calculate the baselines of the intermediate lines by adding \baselineskip to the Y-coordinate of the first marker (or subtracting it from the second of there is a page break between them). This works fine for normal text but leads to wrong positions if the line distance is not equal to \baselineskip, e.g. caused by an overly high element on the line.
Would it be possible to automatically place such a TikZ marker on every line TeX produces? I also might use \zlabel from the zref package in addition to that to determine the page. I searched a little through The TeXBook and had a look at the source code of lineno but both without success. It would be enough to add the marker only when the line is higher than normal. (My current funny ideaTM to solve this is to make some frequent letter active, but I try to avoid such trickery.)