Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Images absolute path not working on external editor #1425

Closed
ianzhuo opened this issue Apr 16, 2019 · 10 comments

Comments

Projects
None yet
2 participants
@ianzhuo
Copy link

commented Apr 16, 2019

Operating system

  • Windows

Application

  • 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!!
圖片

@laurent22

This comment has been minimized.

Copy link
Owner

commented Apr 16, 2019

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

@ianzhuo

This comment has been minimized.

Copy link
Author

commented Apr 16, 2019

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

@laurent22

This comment has been minimized.

Copy link
Owner

commented Apr 20, 2019

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.

@laurent22

This comment has been minimized.

Copy link
Owner

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.

@laurent22 laurent22 closed this in 220f5d0 Apr 20, 2019

@ianzhuo

This comment has been minimized.

Copy link
Author

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.

@laurent22 laurent22 reopened this Apr 22, 2019

@ianzhuo

This comment has been minimized.

Copy link
Author

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.

Atom:

圖片

Typora:

圖片

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

Atom:

圖片

Typora:

圖片

@laurent22

This comment has been minimized.

Copy link
Owner

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.

@ianzhuo

This comment has been minimized.

Copy link
Author

commented Apr 26, 2019

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.

圖片
圖片
圖片

@laurent22

This comment has been minimized.

Copy link
Owner

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?

@ianzhuo

This comment has been minimized.

Copy link
Author

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 laurent22 closed this in b702b0b May 11, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.