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

Syntax highlighting for files (and diffs?) #2

Closed
rtyley opened this issue Dec 6, 2011 · 5 comments
Closed

Syntax highlighting for files (and diffs?) #2

rtyley opened this issue Dec 6, 2011 · 5 comments
Milestone

Comments

@rtyley
Copy link
Contributor

rtyley commented Dec 6, 2011

For presenting blobs, gists, etc we need syntax highlighting...

a) use a WebView (the Android Gmail app renders mail messages using a web view) with a syntax-highlighting JavaScript lib. There are lots of these:

http://shjs.sourceforge.net/
https://github.com/alexgorbatchev/SyntaxHighlighter
https://github.com/isagalaev/highlight.js
http://code.google.com/p/google-code-prettify/
http://ace.ajax.org/ - also a code editor...

b) use a Java highlighting library, but there don't seem to be many maintained libraries around:

http://code.google.com/p/jsyntaxpane/
source-grab from Eclipse or Intellij?

Diffs: Of course, personally I'm in love with animated diffs, and it might be hard to combine the animated diff approach with syntax highlighting - maybe only show plain-black-text during transition...

@kevinsawicki
Copy link
Contributor

After an initial look I think I'm leaning towards shjs with sunburst theme shown here.

@rtyley
Copy link
Contributor Author

rtyley commented Dec 6, 2011

That example renders well on my android browser, very nice. Worth noting that shjs is GPLv3.

@kevinsawicki
Copy link
Contributor

Good point, I made a commit that uses google-code-prettify (apache licensed) in the gist source viewer.

We can play around and tweak it for now and see how it goes

@kevinsawicki
Copy link
Contributor

Switched to using SyntaxHighlighter as it supports more languages and has a line number column.

The downside is where google-code-prettify sniffs for the language, you have to be explicit with SyntaxHighlighter
which adds a bit of gnarly code in Java to ensure that a highlighter brush is always applied.

@kevinsawicki
Copy link
Contributor

Closing now, may revisit if a better solution is found.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants