开发者

Can I share an entire Git project via Gist?

开发者 https://www.devze.com 2023-03-05 20:11 出处:网络
I\'m writing a tutorial for users of our API, and want to incorporate code snippets and complete files for example purposes.I can expose the entire directory structure as a git, for people to download

I'm writing a tutorial for users of our API, and want to incorporate code snippets and complete files for example purposes. I can expose the entire directory structure as a git, for people to download; no problem.开发者_C百科 But I'd like to embed specific code on relevant pages in the way that I can via a gist.

I do that by copying each file into gist, pressing "embed", and copying the resulting link into my tutorial page.

However, it seems wasteful to have a git repo all set up with the full files, then have to duplicate it for each file. Is there a better way to do this?

(Alternatively, if there's a way to embed a reference to a specific file from a git, I could do that too--the use case here is to say, "here's the full sample file" so I'd be fine pulling it that way.)

Thanks.


There is http://gist-it.appspot.com/

GitHub have this on their "list" but we don't know when it will happen.


It seems that embedding any file, not just those from gists, is something that GitHub are planning, but which haven't been done yet:

  • http://support.github.com/discussions/feature-requests/579-embed-files-like-gist
  • http://support.github.com/discussions/gist/238-can-any-github-hosted-file-become-an-embeddable-gist

However, you could do something like this yourself by loading the files dynamically from the "raw" links on GitHub and using SyntaxHighlighter to render them nicely.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号