有人知道如何在markdown显示本地图像吗?我不想为此设置网络服务器。

我尝试以下markdown,但它不起作用:

![](文件/ \用户形象/ jzhang桌面/孤立。png)


当前回答

如果图像有括号,它将不会显示

![alt text](Isolated(1).png)

重命名图像并删除括号

![alt text](Isolated-1.png)

更新: 如果你在文件路径中有空格,你应该考虑重命名它,或者如果你使用JavaScript,你可以使用它编码

encodeURIComponent(imagePath)

此外,总是尝试用小写字母来保存图像和文件,请养成这个习惯,尽管这只是我个人的观点

其他回答

你可能会发现下面的语法类似于markdown中的引用链接,特别是当你有一个文本有许多相同的图像显示时:

![optional text description of the image][number]

[number]: URL

例如:


![][1]

![This is an optional description][2]




[1]: /home/jerzy/ComputerScience/Parole/Screenshot_2020-10-13_11-53-29.png
[2]: /home/jerzy/ComputerScience/Parole/Screenshot_2020-10-13_11-53-30.png

下面的工作与图像到文档旁边的子文件夹的相对路径:

![image info](./pictures/image.png)

要在markdown文件中添加图像,.md文件和图像应该在同一个目录中。在我的情况下,我的.md文件是在doc文件夹,所以我也移动图像到相同的文件夹。然后在.md文件中写入以下语法

![alt text](filename)

[汽车图片](Car .png)

这对我来说很有效。

我有一个解决办法:

a)互联网示例:

![image info e.g. Alt](URL Internet to Images.jpg "Image Description")

b)本地图像示例:

![image Info](file:///<Path to your File><image>.jpg "Image Description")
![image Info](file:///C:/Users/<name>/Pictures/<image>.jpg "Image Description")

涡轮字节

我在R Markdown中插入图像时遇到了问题。如果我做整个URL: C:/Users/Me/Desktop/Project/images/image.png,它倾向于工作。否则,我必须把标记放在与图像相同的目录中,或者放在它的祖先目录中。在引用图像时,似乎忽略了声明的编织目录。