VSTS 降价文档中图像的正确地址是什么?

What is the correct address for an image in a markdown document in VSTS?

我在 Visual Studio Team Services 中托管的 git 存储库的根目录中有一个 README.md 文件。

当我通过项目门户导航到 Web 浏览器中的文件时,我可以看到正确呈现的降价,但图像除外。我想在 README 文件中添加一些屏幕截图,并想知道引用存储在 root of the repository/doc/images/image01.png

文件夹中的图像的正确方法

由于 README 文件也存储在存储库的根目录下,我认为它只是一个亲戚 link。在我的计算机上使用 Visual Studio 代码 (OSX) 时,我可以使用相对路径,并且图像可以使用图像标签正确渲染:

![Alt text](doc/images/readmeFileComparison.png?raw=true "Readme file side by side comparison")

图像标签是否必须不同才能让我在使用浏览器查看自述文件时查看图像(示例 url):

https://myaccount.visualstudio.com/ProjectName/_git/repositoryName?path=%2FREADME.md&version=GBmaster&_a=contents

guidance from Microsoft 但一定有我遗漏的东西。呈现降价时,我得到了一个丢失的图像标签。如果我在新选项卡中打开图像,我会收到 HTTP 500 错误和以下消息:

More information about this error

The item doc/images/pullNewChangesFromMaster.png?raw=true does not exist at the specified version, or you do not have permission to access it.

即使地址中有或缺少前导正斜杠,我也会收到同样的错误。

 ![Alt text](doc/images/pullNewChangesFromMaster.png?raw=true "About to Pull down the new changes")

 ![Alt text](/doc/images/pullNewChangesFromMaster.png?raw=true "About to Pull down the new changes")

正在阅读 Guidance page from Microsoft,我没有看到任何地方提到 ?raw=true

所以最好试试你的亲戚link不用它

![Alt text](doc/images/pullNewChangesFromMaster.png "About to Pull down the new changes")

在处理 markdown 文件中的图像时,区分两种可能的错误很重要:link 错误和语法错误。

1- Link 错误

当 link 损坏时,损坏的图像和您在 [] 中输入的文本将显示在渲染文件中。示例:

![not found text](link/to/the/image.png "hover text")

2- 语法错误

有些情况下渲染器不接受语法。在这种情况下,它将显示您的整个文本。

![not found text](link/to/the image.png "hover text")

结果是这样的:

第二个例子的问题在于它的 URL 中有一个 space 字符。地址中的所有 space 都应替换为 %20,如下所示:

![not found text](link/to/the%20image.png "hover text")