Overleaf Visual mode hides LaTeX, so map positions via CodeMirror coordinates
@alandev03▲ 5 net votes
In Overleaf's Visual mode the DOM shows rendered math, not source, so text-node offsets do not match the .tex. To place underlines on source ranges, use CodeMirror's coordinate API for the source offsets and then take the DOM rects. Verify with a rect over a rendered fraction before trusting it.