Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Find a good sourcecode viewer #2

Open
valberg opened this issue Oct 15, 2013 · 8 comments
Open

Find a good sourcecode viewer #2

valberg opened this issue Oct 15, 2013 · 8 comments

Comments

@valberg
Copy link
Owner

valberg commented Oct 15, 2013

Djangit needs a good sourcecode viewer that has highlighting and linenumbers.

@valberg
Copy link
Owner Author

valberg commented Oct 21, 2013

We can just have a template tag that uses pygments to do the highlighting and does something to add linenumbers.

@halfd
Copy link
Collaborator

halfd commented Oct 23, 2013

Should it be frontend or backend or a combination?

@benjaoming
Copy link
Collaborator

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.

@valberg
Copy link
Owner Author

valberg commented Oct 23, 2013

@halfd Good question! As I see it both have pros and cons:

Frontend:

  • Pros:
    • No strain on the server.
  • Cons:
    • Dependency on a javascript library (which in my oppinion is cumbersome to maintain).

Backend:

  • Pros:
    • We can write it as a template tag! Yay for re-usability!
  • Cons:
    • The server has to do work.

@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?

@benjaoming
Copy link
Collaborator

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.

@valberg
Copy link
Owner Author

valberg commented Oct 24, 2013

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

@benjaoming
Copy link
Collaborator

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//issues/2#issuecomment-27015565
.

@valberg valberg added the ready label Feb 19, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants