简体   繁体   English

vscode 中的 markdown 预览中不显示图像

[英]Images not displaying in markdown preview in vscode

I use VSCode to develop my eleventy based static site.我使用 VSCode 开发基于 110 的 static 站点。 I also use it to edit posts in markdown. The preview of those posts is really helpful, however the image paths don't resolve properly, so they are not visible in the preview.我也用它来编辑 markdown 中的帖子。这些帖子的预览非常有用,但是图像路径无法正确解析,因此它们在预览中不可见。 This is because the root of the website is not the same as the root of the code.这是因为网站的根与代码的根不同。

The posts are in this folder:帖子位于此文件夹中:

/project-folder/src/posts

The images are in this folder图片在这个文件夹里

/project-folder/src/assets/images

But the root of the website is "src" so when adding the image into the markdown file, the path is like this:但是网站的根目录是“src”,所以将图片添加到markdown文件时,路径是这样的:

![](/assets/images/myimage.jpg)

Is there some way of informing the markdown previewer that paths should consider "src" as the root?有什么方法可以通知 markdown 预览器路径应该将“src”视为根? If it's not possible, that's fine too.如果不可能,那也没关系。 But it would be great to get the images to show in the markdown preview.但如果能在 markdown 预览中显示图像,那就太好了。

Thanks.谢谢。

This is a known bug in the current version of VS Code:这是当前版本的 VS Code 中的一个已知错误:

https://github.com/microsoft/vscode/issues/165352 https://github.com/microsoft/vscode/issues/165352

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM