hyperlinking a text in codemirror

You can’t turn the content DOM itself into a hyperlink, but you can do something like this:

  • Register a mouseover handler on the editor

  • When the mouse goes over a token that you are interested in (say, a span with cm-link class, or you could use markText to add a specific class to the elements you’re interested in)…

  • Use charCoords to find the position of that token and overlay your own link, styled to look like the content, over the editor.

1 Like