Use GitHub's own syntax highlighting for diffs on GitHub
GitHub doesn't syntax highlight inside diffs. This extension fixes that.
Other extensions already exist that use a Javascript syntax highlighter to perform a similar task, but this extension instead requests the highligted HTML directly from GitHub and merges it into the page.
This has two advantages:
- The syntax highlighting matches that on the rest of GitHub exactly
- Small diffs without enough context to be parsed properly with Javascript still get highlighted properly
It also has some disadvantages:
- It is highly coupled with GitHub's current HTML output. This is very brittle since the HTML could change and any time and break everything.
- On large diffs, it can require many additional network requests before it will begin its work (this could be somewhat alleviated).
- Because there are many contexts in which diffs appear and the HTML differs for each, I probably missed some cases.
- Due to the brittle design of the whole thing (which essentially merges different GitHub pages into one and has to handle many special cases), it may become out of date at any time and I may or may not have time to fix it.
- It doesn't highlight deleted lines on just-renamed files since GitHub's HTML doesn't usually contain enough information to do that.
- It doesn't highlight inline diffs (such as in comments), since GitHub's HTML doesn't include enough information to do it accurately.
This extension rocks and you should use it until it breaks inexplicably
Download the Safari extension and run it.
Visit the Chrome web store and install the extension.