博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
如何在github存储库中添加屏幕截图到README?
阅读量:2291 次
发布时间:2019-05-09

本文共 3208 字,大约阅读时间需要 10 分钟。

本文翻译自:

Is it possible to place a screenshot in README file in a GitHub repository? 是否可以在GitHub存储库中的README文件中放置屏幕截图? What's the syntax? 语法是什么?


#1楼

参考:


#2楼

If you use Markdown (README.md): 如果您使用Markdown(README.md):

Provided that you have the image in your repo, you can use a relative URL: 如果您的仓库中有图像,则可以使用相对URL:

![Alt text](/relative/path/to/img.jpg?raw=true "Optional Title")

If you need to embed an image that's hosted elsewhere, you can use a full URL 如果您需要嵌入托管在其他位置的图像,则可以使用完整的URL

![Alt text](http://full/path/to/img.jpg "Optional title")

GitHub recommend that you use relative links with the ?raw=true parameter to ensure forked repos point correctly. GitHub建议您使用带有?raw=true参数的相对链接来正确确保forked repos point。

The raw=true parameter is there in order to ensure the image you link to, will be rendered as is. raw=true参数是为了确保您链接的图像,将按原样呈现。 That means that only the image will be linked to, not the whole GitHub interface for that respective file. 这意味着只有图像将链接到,而不是相应文件的整个GitHub接口。 See for more details. 有关详细信息,请参阅 。

Check out an example: 查看示例: :

If you use SVGs then you'll need to set the sanitize attribute to true as well: ?raw=true&sanitize=true . 如果您使用SVG,那么您还需要将sanitize属性设置为true?raw=true&sanitize=true (Thanks @EliSherer) (谢谢@EliSherer)

Also, the documentation on relative links in README files: 此外,有关README文件中相对链接的文档: :

And of course the markdown docs: 当然还有降价文档: :

Additionally, if you create a new branch screenshots to store the images you can avoid them being in the master working tree 此外,如果您创建新的分支screenshots来存储图像,则可以避免它们位于master工作树中

You can then embed them using: 然后您可以使用以下方法嵌入它们:

![Alt text](/../
/path/to/image.png?raw=true "Optional Title")

#3楼

I found that the path to the image in my repo did not suffice, I had to link to the image on the raw.github.com subdomain. 我发现我的raw.github.com的图像路径不够,我不得不链接到raw.github.com子域上的图像。

URL format https://raw.github.com/{USERNAME}/{REPOSITORY}/{BRANCH}/{PATH} 网址格式https://raw.github.com/{USERNAME}/{REPOSITORY}/{BRANCH}/{PATH}

Markdown example ![Settings Window](https://raw.github.com/ryanmaxwell/iArrived/master/Screenshots/Settings.png) Markdown示例![Settings Window](https://raw.github.com/ryanmaxwell/iArrived/master/Screenshots/Settings.png)


#4楼

One line below should be what you looking for 下面的一行应该是你要找的

if your file is in repository 如果您的文件在存储库中

![ScreenShot](https://raw.github.com/{username}/{repository}/{branch}/{path})

if your file is in other external url 如果您的文件在其他外部网址中

![ScreenShot](https://{url})

#5楼

With the images located in /screen-shots directory. 图像位于/screen-shots目录中。 The outer <div> allows the images to be positioned. 外部<div>允许定位图像。 Padding is achieved using <img width="desired-padding" height="0"> . 使用<img width="desired-padding" height="0">来实现<img width="desired-padding" height="0">

About screen
List screen

#6楼

Even though there is already an accepted answer I would like to add another way to upload images to readme on GitHub. 即使已经有一个已接受的答案,我想添加另一种方法将图像上传到GitHub上的自述文件。

  • You need to create issue in your repo 您需要在回购中创建问题
  • Drag and drop in the comment area your image 拖放图像的注释区域
  • After link for the image is generated insert it to your readme 生成图像链接后,将其插入自述文件

More details you can find 您可以在找到更多详情

转载地址:http://oicnb.baihongyu.com/

你可能感兴趣的文章
cmake 简介
查看>>
CMake学习笔记(1)——用CMake编译一个hello world程序
查看>>
cmake使用总结---工程主目录CMakeList文件编写
查看>>
CMake学习之路
查看>>
cmake学习笔记6-catkin的CmakeList.txt讲解
查看>>
cmake手册详解
查看>>
Maplab框架介绍(一)
查看>>
Maplab开源VI-SLAM框架介绍
查看>>
maplab(1):安装
查看>>
陀螺仪随机误差的Allan方差分析
查看>>
Ubuntu 64位安装Adobe Reader 9.5.5
查看>>
Ubuntu 下如何查看已安装的软件
查看>>
Linux 系统下可以注释标注的pdf阅读器安装、比较和推荐
查看>>
福昕阅读器foxit reader Linux版
查看>>
Ubuntu 安装百度云客户端
查看>>
每天一个linux命令:locate
查看>>
Linux 环境下载百度云资源,Firefox插件(百度网盘助手)
查看>>
ubuntu Firefox/chrome adobe flash 插件安装
查看>>
OpenCV图像变换(仿射变换与透视变换)
查看>>
仿射变换与透视变换
查看>>