On 12/27/2015 07:22 AM, Lars Ingebrigtsen wrote: > Clément Pit--Claudel writes: > >> I looked into this more, but I don't think it will work. I want to >> highlight the context of the element that contains the target id, so >> if lines are not broken up then highlighting the full line works >> well. If they are, on the other hand, then I can't tell how much >> surrounding text to highlight. > > I'm not sure what you mean by "context". But you can look "down" into > the DOM and see if your id is in an element there. Or you can transform > the HTML, or transform the DOM, to wrap the elements you want to > highlight. > > For instance, you can loop over all elements that have ids that match > with `dom-by-id', and you can alter the DOM to insert, say, h1 elements > around those that you want to have highlit. Thanks for the suggestions. It's not always obvious what element I want to highlight, though, beyond "everything that ends up on the same line. It may be that the thing I want to draw the attention of the user to is in a paragraph; in that case, I highlight the full paragrahp. Or it may be in a title; in that case, I highlight the full title. Or it may be part of a list; in that case I only highlight the item that contains it. When the text that shr inserts isn't wrapped, I just need to highlight the line that contains that text after rendering is complete. When it is wrapped, however, it becomes unclear what exactly to highlight. Clément.