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


当前回答

用于显示图像的markdown语法确实是:

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

但是:如何提供url ?

你可能不想用截图把你的回购弄得乱七八糟,它们和代码没有任何关系 你可能不想处理把你的图片放到网上的麻烦。(上传到服务器…).

所以…你可以使用这个很棒的技巧让github托管你的图像文件。TDLR:

在回购的问题列表上创建一个问题 在这个问题上拖放你的截图 复制标记代码,github刚刚为你创建显示你的图像 将其粘贴到您的自述文件(或任何您想要的地方)

http://solutionoptimist.com/2013/12/28/awesome-github-tricks/

其他回答

Markdown: !黑“更加铝(http://url/to/img.png)

创建一个关于添加图像的问题 通过拖放或文件选择器添加图像 然后复制图像源 现在添加![截图](http://url/to/img.png)到您的README。md文件

完成了!

或者,你也可以使用一些图像托管网站,如imgur,并获得它的url,并将其添加到你的README。Md文件或者你也可以使用一些静态文件托管。

样品的问题

用于显示图像的markdown语法确实是:

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

但是:如何提供url ?

你可能不想用截图把你的回购弄得乱七八糟,它们和代码没有任何关系 你可能不想处理把你的图片放到网上的麻烦。(上传到服务器…).

所以…你可以使用这个很棒的技巧让github托管你的图像文件。TDLR:

在回购的问题列表上创建一个问题 在这个问题上拖放你的截图 复制标记代码,github刚刚为你创建显示你的图像 将其粘贴到您的自述文件(或任何您想要的地方)

http://solutionoptimist.com/2013/12/28/awesome-github-tricks/

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

在存储库中从上传文件选项添加图像,然后在README文件中

![Alt text]("enter image url of repositoryhere") 

将此添加到README

<div align="center">
    <img src="/screenshots/screen1.jpg" width="400px"</img> 
</div>