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 diff #42

Open
rhd opened this issue Jan 19, 2016 · 3 comments
Open

syntax highlighting for diff #42

rhd opened this issue Jan 19, 2016 · 3 comments

Comments

@rhd
Copy link

rhd commented Jan 19, 2016

Hi, it would be great if syntax highlighting worked for diffs (git diff). It seems to detect the python code, but not the fact it's an actual diff and I don't see a way to force it.

Thanks!

@andre-d
Copy link
Contributor

andre-d commented Jan 19, 2016

The system used is highlight.js which is meant to have diff support
On Jan 19, 2016 5:44 PM, "rhd" [email protected] wrote:

Hi, it would be great if syntax highlighting worked for diffs (git diff)
It seems to detect the python code, but not the fact it's an actual diff
and I don't see a way to force it

Thanks!


Reply to this email directly or view it on GitHub
#42.

@rhd
Copy link
Author

rhd commented Jan 19, 2016

Hmm, it kind of works. For some reason this is being detected as python (I'm assuming) instead of diff. Thoughts?

diff --git a/libs/python/a/a.py b/libs/python/a/a.py
index 8cc7156..2bb880b 100644
--- a/libs/python/a/a.py
+++ b/libs/python/a/a.py
@@ -1033,12 +1033,13 @@ def aa(options):
     """Yaaaa"""
     # aaat
     bbb = 0
-    if options.seek:
-        bbb = f(options.indir, options.a, options.b, options.c, options.d)

     # aaaaaa
     closeHook = xTimeCloseHook(deleteIt=options.a, flagIt=options.b, closeCount=3)

@Zegnat
Copy link

Zegnat commented Jan 24, 2016

Highlight.js uses a concept called relevance to auto-detect languages. Their diff parser only adds relevance for lines wrapped in @@, ***, and ---. There are none of those in your example, so it would never be matched as a diff.

Nothing that can be done other than getting the diff parser improved or waiting for #33 so you can force diff highlighting.

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

3 participants