包含 github 提交的一部分的片段? (没有要点)

A snippet that contains a part of a github commit ? (without gist)

我想在我的网站上显示一些代码行(使用 GithubPages 和 Jekyll 创建),从我的存储库的提交中提取。

示例:

https://github.com/fredericletellier/udacity-builditbigger/blob/6fe561a9e514de2e7175e2c16c5b3a1280223d2e/jokelib/src/main/java/com/joke/JokeProvider.java#L15-L22

https://github.com/fredericletellier/udacity-builditbigger/commit/6fe561a9e514de2e7175e2c16c5b3a1280223d2e?diff=unified#diff-6359bfff8a23dfc88d092acc996f6f97

但是我需要引用很多代码,将我的代码复制粘贴到 gist 上很长。目前,我可以提供一个 link 到有趣的代码。

我能找到一个简单的方法来在片段中显示这段代码吗?


更新

如果您有其他答案,欢迎您!

我找到了答案:https://gist-it.appspot.com/


第一个例子,分支最新版本的文件,不应该使用。

更改代码后,代码段显示有问题。喜欢在特定提交中使用永久链接到文件,如第二个示例:https://help.github.com/articles/getting-permanent-links-to-files/


第二个例子,特定version/commit中的文件或文件的一部分:

<script src="http://gist-it.appspot.com/https://github.com/fredericletellier/udacity-builditbigger/blob/6fe561a9e514de2e7175e2c16c5b3a1280223d2e/jokelib/src/main/java/com/joke/JokeProvider.java?slice=14:22&footer=0"> </script>