git 查看 Gist 的渲染输出?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10717169/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 06:57:20  来源:igfitidea点击:

View rendered output of a gist?

gitgithubgist

提问by flossfan

I'm sure I'm being dim, but is it possible to view the rendered output of a gist?

我确定我很昏暗,但是是否可以查看 Gist 的渲染输出?

This is the gist I'm interested in: https://gist.github.com/844752/420cc52eb4910fe8fa2bec9e13daab18b6230503

这是我感兴趣的要点:https: //gist.github.com/844752/420cc52eb4910fe8fa2bec9e13daab18b6230503

Where can I see how it actually renders?

我在哪里可以看到它的实际呈现方式?

采纳答案by Manu Letroll

As far as I know gist doesn't provide an execution environment, but you could easily paste this in jsfiddle.

据我所知,gist 不提供执行环境,但您可以轻松地将其粘贴到jsfiddle 中

回答by 0xcaff

rawgit.comprovides this service. To use rawgit.com, simply replace the domain of the raw view of the gist or github file you want to view with rawgit.com. For example:

rawgit.com提供此服务。要使用 rawgit.com,只需将要查看的 gist 或 github 文件的原始视图的域替换为 rawgit.com。例如:

https://gist.githubusercontent.com/mbostock/844752/raw/index.html

to

https://rawgit.com/mbostock/844752/raw/index.html

or

或者

https://raw.githubusercontent.com/caffinatedmonkey/Hello-World-PSP/master/main.cpp

to

https://rawgit.com/caffinatedmonkey/Hello-World-PSP/master/main.cpp

回答by Dee Newcum

RawGithub.com will let you render anything on Github, including gists. Two examples:

RawGithub.com 可以让你在 Github 上渲染任何东西,包括要点。两个例子:

回答by Danny_Joris

Mike Bostock made a cool application to render Gists: http://bl.ocks.org/844752/420cc52eb4910fe8fa2bec9e13daab18b6230503

Mike Bostock 做了一个很酷的应用来渲染 Gists:http://bl.ocks.org/844752/420cc52eb4910fe8fa2bec9e13daab18b6230503

Still, I'm interested how this is done technically. GitHub has a cool api through which you can get gist data as JSON: https://api.github.com/gists/844752/420cc52eb4910fe8fa2bec9e13daab18b6230503It includes the files and their raw contents. I don't know how to render it dynamically as if they were actual files on a filesystem.

不过,我对如何在技术上做到这一点很感兴趣。GitHub 有一个很酷的 api,您可以通过它获取 JSON 形式的要点数据:https://api.github.com/gists/844752/420cc52eb4910fe8fa2bec9e13daab18b6230503它包括文件及其原始内容。我不知道如何动态渲染它,就好像它们是文件系统上的实际文件一样。

回答by Stéphane Laurent

I'm under the impression the way to render a gist has recently changed. Here is the solution I have found :

我的印象是渲染要点的方式最近发生了变化。这是我找到的解决方案:

  • go to http://rawgit.com/, paste the adress of your gist and get the adress to the raw html code - or click on the rawbutton in Github
  • prepend to the URL: http://htmlpreview.github.io/?
  • 转到http://rawgit.com/,粘贴您的 gist 的地址并将地址获取到原始 html 代码 - 或单击Github 中的原始按钮
  • 在 URL 前添加: http://htmlpreview.github.io/?

Example

例子

回答by Max

Gist renders output (currently after updating gist, not live preview).

Gist 呈现输出(当前在更新 Gist 之后,而不是实时预览)。

This works only with proper file extension.

这仅适用于正确的文件扩展名。

For example, if your file is formatted as MediaWiki, you have to edit the file name as somefile.mediawiki

例如,如果您的文件格式为 MediaWiki,则必须将文件名编辑为 somefile.mediawiki

回答by BaSsGaz

You can do it right in GitHub. I simply use the comment section as it already has its own 'Preview' option, and of course "Styling with Markdown is supported".

你可以在 GitHub 上做到这一点。我只是使用评论部分,因为它已经有自己的“预览”选项,当然“支持使用 Markdown 进行样式设置”。