@DougC Thank you so much! I will dig into that code and let you know if I have any questions
I’m a Codmirror novice so I’m still struggling with orienting myself in this ecosystem and am not always sure to look for answers or even what questions to ask.
Essentially I’m trying to design a system for children who are just starting to learn HTML. The idea is that they could mouse-over the rendered HTML in their browser (an iframe) and the corresponding source code would then be highlighted in the editor.
I have the first part working: I can capture the code that is being moused-over. That’s the easy part (using document.elementFromPoint in the iframe itself, and then posting that as a message). The part I’m struggling with is how to search for that code in the editor, and then highlight it. So, for example, if the the child mouses-over a GIF of kittens, the corresponding code in the editor would be highlighted: <img src="kittens.gif>