7

gist.github.com has a great feature where you can embed the current version of a file in a blog via a <script/> tag.

However, I can't seem to embed an older revision, or the current atomic revision in such a way, that further commits won't update what's embedded by the embed tag. Is this possible?

  • So you want to post static content that is highlighted basically. – phwd Jan 15 '12 at 19:58
  • @phwd Well, the idea is that I would have a blog article about a specific revision of the file. In the future I might have a different revision, which I might or might not embed anywhere. Now imagine if this embed functionality was part of regular github repos. Maybe I wanted to embed a particular commit in a blog (or bug tracking system) – Justin Dearing Jan 15 '12 at 22:57
8

Just add .js to the end of the URL like this: https://gist.github.com/1522901/0f74d53b18060f6292db9dc4d6c1922f72aa2aaf.js

1

Unless Github makes this possible (perhaps with a feature request/service hook), one easy way would be to simply display the contents of the gist using its complete url along with the commit hash, such as https://gist.github.com/1522901/0f74d53b18060f6292db9dc4d6c1922f72aa2aaf, and then just use some third party code highlighting library for displaying it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.