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.

The benefit is that CSS highlights can't impact layout, so there's a performance benefit to using them rather than spans etc. How would highlightmap work? Some standardised tokenizer?

0 reposts4 likes

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