3 ms·
In my opinion it is irresponsible to post strongly worded opinions such as these, because you forget you may not be seeing the whole picture. Cons when the s
by Confusion 12y ago
In my opinion it is irresponsible to post strongly worded opinions such as these, because you forget you may not be seeing the whole picture.
Cons when the server do the lexing ONCE:
- NOTHING
You are assuming a specific use case, where static code originally exists on the server and the highlighted version is included in a page that is viewed many times.
My use case for these libraries is different: users actually write 'code' in my app, which I wish to highlight as they type it. Of course many users will write the same fragments and energy could be saved by caching the highlighting of those on the server. However, the latency of that solution (roundtrip to server needed to highlight code) and the code complexity (cache expiration is one of the two 'hard' problems in SE) are much worse than for the client-side highlighting solution.
- accatyyc 12y agoThat's an entirely different problem I'd say, and the perfect use case for these libraries on a client! If you'd do it server side it would be like a local IDE sending the code to be lexed remotely... My rantiness (I apologize for that) targets programming blogs/static pages.