Images absolute path not working on external editor #1425

Closed
opened this issue Apr 16, 2019 · 10 comments

Projects
None yet
2 participants

• Windows

• Desktop

External Editor

• Visual Studio Code

In Joplin internal Editor, images normally show like this.

When a note open in external editor, images link will be convert to absolute path like D:\path\to\images.png, but can not work properly.

after modified image link to relative path ..\\path\\to\\images.png, everything worked!!

Owner

laurent22 commented Apr 16, 2019

 Does it also work if you replace all the \ of the full path with \\?

Author

ianzhuo commented Apr 16, 2019 • edited

 Nope, absolute path seems not working on VScode, only relative path worked. In my test, all \ need to be replaced to \\
Owner

laurent22 commented Apr 20, 2019 • edited

 Still not clear what the issue is. If really it supports relative paths but not absolute ones, it's a bug with VSCode and something you should raise in their issue tracker. On the other hand if the issue is that it doesn't support single \ but only double \ then it's something we can fix, but I'm not going to install VSCode to confirm.
Owner

laurent22 commented Apr 20, 2019

 Do paths like file://c:/someimage.png show up in VSCode? I'm thinking about changing the implementation to this kind of path as that would be more standard and perhaps it works in VSCode.

Author

ianzhuo commented Apr 22, 2019

 Hi laurent22, I've found that problem as link below yzhang-gh/vscode-markdown#118 We now restrict the markdown preview to only loading resources inside the current workspace for security reasons microsoft/vscode#45260 (comment) It's a restriction from VScode, and it seems that I have to edit md without Image Preview(or choose another editor). lol Anyway, thanks for your kindly help.

Author

ianzhuo commented Apr 24, 2019

Hi,
I've tried Typora and Atom with Joplin v143.
Test result as below, FYI.

orgin external link is:![](file://C%3A/........
doesn't work on both editor.

Typora:

after modify as ![](C:/...
both editor worked.

Typora:

Owner

laurent22 commented Apr 26, 2019

 Any chance you could test with relative link in typora and atom? If it does work I guess that's what we should use as that way it will also work on vscode.
Author

ianzhuo commented Apr 26, 2019 • edited

 for test, I make a /resources copy under /tmp and rename as "/resources-underworkspace" /JopolinProfile ---/resources ---/tmp ------/resouces-underworkspace In vscode, relative link only wroked under workspace. atom and typora accept absolute link and relative link. Perhaps you should consider create temporary md file under /JoplinProfile to make all external editor work with image preview.
Owner

laurent22 commented Apr 27, 2019

 Many thanks for looking into it @ianzhuo. What do you mean by workspace? Does it mean that the temp md file and resource files need to be under the same directory? If not, could you explain what directory structure would work under vscode?
Author

ianzhuo commented Apr 27, 2019

 Yes it does. In vsocde, /resources and temp md file must be in the same directory to make markdown preview worked.

laurent22 added a commit that referenced this issue May 11, 2019

 Fixed regressions following fix for #1425 
 afb3759 

laurent22 added a commit that referenced this issue May 11, 2019

 Fixed regression following fix for #1425 
 0d036d8