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


当前回答

方法1->降价方式

![Alt Text](https://raw.github.com/{USERNAME}/{REPOSITORY}/{BRANCH}/{PATH})

方法2->HTML方式

<img src="https://link(format same as above)" width="100" height="100"/>

or

<img src="https://link" style=" width:100px ; height:100px " />

如果你不想样式你的图像,即调整大小,删除样式部分

其他回答

对我来说,相对路径非常有效。

我是怎么做到的: 在我当前的md文件中,我想使用来自另一个目录的图片,我使用了这样的相对路径-考虑以下点。

Md文件loc: base dir -> _post -> current_file.md

&图片文件loc,我想使用:基础dir -> _asset -> picture_to_use.jpeg

我使用的语句是在current_file上。md文件:

![your-pic-caption-name](../_asset/picture_to_use.jpeg)

注意-在此之前,我使用的是direct _asset,但理想情况下,它从../_asset/and-so-no开始

参考资料- https://docs.github.com/en/github/creating-cloning-and-archiving-repositories/creating-a-repository-on-github/about-readmes

将此添加到README

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

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

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

完成了!

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

样品的问题

使用位于/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>

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