直接在博客中显示 Github 个存储库文件
Display Github repository files directly in a blog
我有一个博客,我想在我的 post 中添加一些代码片段。
我发现这个 "gist" 非常方便,但看起来它只适用于您直接粘贴的代码。我已经熟悉语法高亮器和类似工具,但仍然不能满足我的要求。
我发现一个非常有用的工具,它允许您直接在博客中显示 Github 存储库文件。想象一下,将存储库文件的 url 提供给 gist,然后将提供的源 gist 粘贴到 post 中。
有没有办法将 link 文件存储在 public Github 存储库中,以便我可以将它们作为代码片段显示在我的博客中?
您实际上可以使用名为 Gist-it 的工具来执行此操作。
Usage
Take a github file url and prefix it with http://gist-it.appspot.com and embed the result within a tag:
<script src="http://gist-it.appspot.com/http://github.com/$file"></script>
$file should follow the github repository pattern of
$user/$repository/raw/master/$path
github/$file is a shorthand for http://github.com/$file and works in the same way
这是我刚刚按照他们的指南进行的测试。
有效!
我有一个博客,我想在我的 post 中添加一些代码片段。
我发现这个 "gist" 非常方便,但看起来它只适用于您直接粘贴的代码。我已经熟悉语法高亮器和类似工具,但仍然不能满足我的要求。
我发现一个非常有用的工具,它允许您直接在博客中显示 Github 存储库文件。想象一下,将存储库文件的 url 提供给 gist,然后将提供的源 gist 粘贴到 post 中。
有没有办法将 link 文件存储在 public Github 存储库中,以便我可以将它们作为代码片段显示在我的博客中?
您实际上可以使用名为 Gist-it 的工具来执行此操作。
Usage
Take a github file url and prefix it with http://gist-it.appspot.com and embed the result within a tag:
<script src="http://gist-it.appspot.com/http://github.com/$file"></script>
$file should follow the github repository pattern of $user/$repository/raw/master/$path github/$file is a shorthand for http://github.com/$file and works in the same way
这是我刚刚按照他们的指南进行的测试。
有效!