Post

I don’t see how riddling your content with markers to do syntax highlighting would fare any better than the span soup approach. I see more benefit in something like `<script type="highlightmap">` + `<pre highlightedby=highlightmap>` in which the browser would do it all by itself (+ is polyfillable)

It depends what you mean by "riddling your content". If you add a range to the DOM, it's there, as part of your DOM. Sure, the elements panel doesn't show it, but it probably will at some point, for debugging CSS highlights.

A serialized object that represents all range information you prebuild on the server (once, preferably)

Seems interesting, but it's still going to riddle the DOM with ranges. You just won't see them. It also increases the change that you'll mutate the content of the element but forget to update the highlightmap.

0 reposts4 likes