Open valberg opened 10 years ago
We can just have a template tag that uses pygments to do the highlighting and does something to add linenumbers.
Should it be frontend or backend or a combination?
You could go for server-side where the highlighting is generated and cached upon the first request.
Problem: When to clean up the cache.
If you don't do caching, then server-side generation seems futile, since the client has the advantage of being much more versatile and flexible to suit user needs.
@halfd Good question! As I see it both have pros and cons:
Frontend:
Backend:
@benjaoming Doing caching on the highlighting might be a good idea. But I can foresee that it becomes quite a cache. You would have to cache every blob and diff. But maybe that's not so bad?
Holistically, if you make the same expensive computation twice, it's a bad idea... so caching stuff like that is a really good thing. However, you can use the django cache proxy functions which allows people to have various cache backends.
I'm beginning to think that doing the highlighting on the frontend is a better solution.
Just found this: https://github.com/isagalaev/highlight.js
Cool, do you know what the numbers in the parathesis on this page mean? http://softwaremaniacs.org/media/soft/highlight/test.html
On 24 October 2013 20:05, valberg notifications@github.com wrote:
I'm beginning to think that doing the highlighting on the frontend is a better solution.
Just found this: https://github.com/isagalaev/highlight.js
— Reply to this email directly or view it on GitHubhttps://github.com/valberg/djangit/issues/2#issuecomment-27015565 .
Djangit needs a good sourcecode viewer that has highlighting and linenumbers.