imagevisual-studio-codepathmarkdownpreview

Images not displaying in markdown preview in vscode


I use VSCode to develop my eleventy based static site. 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. 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:

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

Is there some way of informing the markdown previewer that paths should consider "src" as the root? If it's not possible, that's fine too. But it would be great to get the images to show in the markdown preview.

Thanks.


Solution

  • This is a known bug in the current version of VS Code:

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