GitHub – Get Gist File URL with Syntax Coloring

github

I just pasted this multi-file gist:

https://gist.github.com/anonymous/57e871d6779a0a38354f

For some reason, GitHub decides to display both 20K+ line- files in full, making the master page a bit unresponsive. So I thought I'd work with links to individual files.

GitHub for the main file links provides this:

https://gist.github.com/anonymous/57e871d6779a0a38354f#file-test-tex

… which is basically an anchor into the exact same address as the first above.

And then, a raw link is provided:

https://gist.github.com/anonymous/57e871d6779a0a38354f/raw/560a455b063f177e7bba7a4a32320a66f56b3388/testlog.diff

… which, being plain text, obviously contains no syntax coloring.

There is also this under the link titled "view the full file" (where it appears):

https://gist.github.com/anonymous/57e871d6779a0a38354f/raw/testlog.diff

… but it again serves a plain text file, with no syntax coloring.

Can I somehow obtain a link to a single file that will be served using GitHub's usual syntax coloring display?

Best Answer

I don't believe Github offers the ability to view a single highlighted file that is part of a multi-file gist, unfortunately.

You could:

A) Re-paste that file into it's own separate gist.

B) Use another service to highlight code for you such as Rouge. It's an open source project that does syntax highlighting and allows you to save the data you highlighted for viewing or sharing.

Sorry it's not exactly what you wanted, but perhaps one of these might work for you.