是否可以在一个GitHub存储库的README文件中放置一个截图?语法是什么?


当前回答

尽管已经有了一个公认的答案,我想添加另一种方式来上传图片到GitHub上的自述。

你需要在你的回购中制造问题 拖放在评论区你的图像 图像链接生成后,将其插入到自述文件中

更多细节你可以在这里找到

其他回答

首先,在本地repo的根目录下创建一个目录(文件夹),其中将包含您想要添加的屏幕截图。让我们把这个目录的名称称为屏幕截图。将你想要添加的图片(JPEG、PNG、GIF等)放到这个目录中。

Android Studio工作空间截图

其次,您需要将每个图像的链接添加到README中。所以,如果我的截图目录中有命名为1_ArtistsActivity.png和2_AlbumsActivity.png的图像,我将像这样添加它们的链接:

 <img src="screenshots/1_ArtistsActivity.png" height="400" alt="Screenshot"/> <img src=“screenshots/2_AlbumsActivity.png" height="400" alt="Screenshot"/>

如果你想让每个截图在单独的行上,把它们的链接写在单独的行上。但是,最好将所有链接写在一行中,仅用空格分隔。它可能看起来不太好,但通过这样做,GitHub会自动为你安排它们。

最后,提交您的更改并发布它!

尽管已经有了一个公认的答案,我想添加另一种方式来上传图片到GitHub上的自述。

你需要在你的回购中制造问题 拖放在评论区你的图像 图像链接生成后,将其插入到自述文件中

更多细节你可以在这里找到

从2021年3月起,现在支持:

将文件附加到标记文件

You can now attach files, including images, to markdown files while you're editing them in the web. This works just like file attachments in issues and pull requests and supports the same file types. Just drag and drag, click and select, or paste. Note: If you add an image to a markdown file, anyone can view the anonymized image URL without authentication, even if the markdown file is in a private repository. To keep images private, serve them from a private network or server that requires authentication. For more information on anonymized URLs see "About anonymized image URLs".

2020年6月3日:工作答案-

把你的图片上传到postmage.org 上传图片后复制Github-Markdown-Url 插入你的ReadMe

使用位于/screen-shots目录中的图像。外部的<div>允许图像被定位。填充是使用<img width="desired-padding" height="0">实现的。

<div align="center">
        <img width="45%" src="screen-shots/about.PNG" alt="About screen" title="About screen"</img>
        <img height="0" width="8px">
        <img width="45%" src="screen-shots/list.PNG" alt="List screen" title="List screen"></img>
</div>