图像没有出现在GitHub上的README.md中 [英] Image not showing up in README.md on GitHub

查看:207
本文介绍了图像没有出现在GitHub上的README.md中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用下面的降价将图像添加到我的存储库中的 README.md

 ![ScreenShot](https://github.com/i-saumitra/Voice-controlled-MP3-Player/blob/master/screenshot.jpg)

但是当我访问我的存储库时,图像没有显示。
取而代之的是图片链接。点击链接将在新窗口中打开图片。



我也尝试过使用相对路径:

<$ p $但是,这是给予的,但是,这是给予

README.md 中显示图片的正确减价是什么?



这两个 README.md 和图像文件位于相同的路径/目录中。



显示图像的正确方法是什么github README.md?



README.md文件的完整内容如下:

 语音控制MP3播放器
===========================

接受诸如PLAY,PAUSE,FORWARD等语音命令的MP3播放器。使用C#和Microsoft Speech API。

![ScreenShot](https://github.com/i-saumitra/Voice-controlled-MP3-Player/blob/master/screenshot.jpg)
自1月份以来, GitHub现在支持标记文档中的相关链接。



这意味着您的代码![ScreenShot](screenshot.jpg)现在可以完美地工作了。

正如@Brad所指出的那样,这可能会缓解两个分支中图像不同的情况,但也可以保持一致。在这种情况下,从一个分支切换到另一个分支会动态切换渲染视图中的图像,因此不需要对Readme内容进行任何更改。


  • 关于用户内容


    I am trying to add an image to the README.md in my repository using markdown below:

    ![ScreenShot](https://github.com/i-saumitra/Voice-controlled-MP3-Player/blob/master/screenshot.jpg)
    

    But the image is not showing when I visit my repository. Instead the link to the image is showing up. Clicking the link will open the image in new window.

    I have also tried using relative path:

    ![ScreenShot](screenshot.jpg)
    

    But this is giving page not found error.

    What is the correct markdown to display image in README.md

    Both README.md and image file are in same path/directory.

    What is the correct way to display an image in github README.md?

    Complete content of README.md file is as below:

    Voice-controlled-MP3-Player
    ===========================
    
    A MP3 player which accept voice command like PLAY, PAUSE, FORWARD, etc. Using C# and Microsoft Speech API.
    
    ![ScreenShot](https://github.com/i-saumitra/Voice-controlled-MP3-Player/blob/master/screenshot.jpg)
    

    解决方案

    Updated content

    Since January, 30th 2013, GitHub now supports relative links in markup documents.

    This means that your code ![ScreenShot](screenshot.jpg) would now work flawlessly.

    As pointed by @Brad, this may also ease a scenario where the images are different in two branches, but bear the same. In that case, switching from one branch to another, would dynamically switch the image in the rendered view, thus without requiring any change to the Readme content.

    Previous answer when GitHub wasn't supporting relative links

    You have to use the raw url format. In your case that would be https://raw.githubusercontent.com/i-saumitra/Voice-controlled-MP3-Player/master/screenshot.jpg

    This means that the correct markdown would be the following

    ![ScreenShot](https://raw.githubusercontent.com/i-saumitra/Voice-controlled-MP3-Player/master/screenshot.jpg)
    

    Using this in a .mdfile on github will display the following picture ;-)

    Update following your comment

    where is this officialy documented that we have to use raw...i couldn't find it anywhere

    This URL format is an undocumented feature of the GitHub site. This means that it could change later. If that ever happens, in order to "rediscover" the new format, click the Raw button when displaying a image. This will "open" the image in your browser. Copy the URL and Voilà!

    Note: Although the repository is no longer on hosted on GitHub, I've updated the urls to reflect the new GitHub policy regarding user content

    这篇关于图像没有出现在GitHub上的README.md中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆