Change:
private _createInset(webviewService: IWebviewService, content: string) { const workspaceFolders = this.contextService.getWorkspace().folders.map(x => x.uri); <ins> const notebookDir = dirname(this.documentUri); </ins> this.localResourceRootsCache = [ ...this.notebookService.getNotebookProviderResourceRoots(), ...this.notebookService.getRenderers().map(x => dirname(x.entrypoint)), ...workspaceFolders, <ins> notebookDir, </ins> ...this.getBuiltinLocalResourceRoots(), ]; const webview = webviewService.createWebviewElement({

Discussion:
[X] Notebooks (.ipynb files) [ ] Interactive Window and/or Cell Scripts (.py files with #%% markers) I've tried to insert an image in Markdown cell. All I got is a broken link. The same notebook works fine in Jupyter Notebook in a browser, and the image is clearly shown. The image file really is in that location. Also tried: Version: 1.69.2 (user setup) Commit: Date: 2022-07-18T16:12:52.460Z Electron: 18.3.5 Chromium: 100.0.4896.160 16.13.2 V8: 10.0.139.17-electron.0 OS: WindowsNT x64 10.0. v2022.6. Python v3.10.5 No response No response_ Local
seems to be working for me. Does it render if you use the full filepath? Can you try just running some python from that same notebook to see if it can access the file?
Keep in mind, all of this works just fine in Jupyter Notebook in a browser. It just doesn't work in VSCode. works just fine. Full path does not work. The outcomes are the same on Win10 and MacOS. This is the notebook. Keep in mind the path for the PNG is wrong in the notebook as-is in the repo.
I see a problem when the file is opened by itself. Can you try opening the entire qiskit-tutorials folder ( ), that should let the images render (even the original, since that image is in two places). It also works on Not being able to render images with paths outside the workspace seems like a bug though, I'll transfer to core, since they control markdown rendering.
Opening the whole repo folder - the image tag works just fine in VSCode. Yes, the issue occurs when I open that ipynb file all by itself. That means many notebooks created with Jupyter Notebook but opened with VSCode will exhibit this bug - if the image files are in certain locations.
The described behavior is how it is expected to work. If you disagree, please explain what is expected and what is not in more detail. See also our . Happy Coding!

Setup: start the application, close all workspaces, all folders and all files open a single notebook file in the app the notebook file has a markdown cell, with an image tag, with a valid path to a valid image file the image file path may be relative to the notebook, or may be absolute (referencing the root of the filesystem) the image file is in a folder location different from the notebook file Results: Jupyter Notebook shows the image correctly VSCode throws an error Expected results: the image should always be displayed correctly as long as the path is valid (either relative or absolute)
See For security reasons we don't support loading images (or any resource) that needs to traverse up from the directory where the notebook is stored
The issue still happens when the image folder is on the same level with the notebook. E.g. the file path may be: or
Ah ok. The issue title and the example notebook you linked to both seemed to be about the case so I was confused I've fixed the title and am reopening to investigate