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


当前回答

对我来说,最好的办法是

用github上的存储库创建一个新问题,然后以gif格式上传文件。要将视频文件转换为gif格式,您可以使用这个网站http://www.online-convert.com/ 提交新创建的问题。 复制上传文件的地址 最后在你的README文件中放入!

希望这能有所帮助。

其他回答

[截图](截图.png)就像上面提到的那样。将截图.png替换为您在存储库中上传的图像的名称。

但当你上传图片时,这里有一个新手提示(我自己也犯了这个错误):

确保映像名称不包含空格。我的原始图片被保存为“截图日月年id.png”。如果您不将名称更改为类似contenttofimage .png的名称,那么它将不会作为图像出现在自述文件中。

首先,在本地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会自动为你安排它们。

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

请休息这四步, 这对我很有效

1-在GitHub上创建一个新问题。 拖放图片到评论栏或上传照片。 3 .等待上传完成。 4 .复制URL并在GitHub上的Markdown文件中使用它(在存储库的自述中使用生成的URL)。

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

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

从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".