user131948
user131948

Reputation:

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.

Upvotes: 6

Views: 14139

Answers (2)

Pierre Goch
Pierre Goch

Reputation: 109

I have a very strange behavior The markdown is located in the folder /md under project root Images are under /md/res In /md/myfile.md I have and id cannot display the pic in preview, but well when I print the preview If I replace by /md/res/mypic.jpg (full path from root), it dispays in preview but not any more when I print the preview!

Upvotes: 0

user131948
user131948

Reputation:

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

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

Upvotes: 2

Related Questions