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

Image relative path is relative to root folder that you open, not the file. #2901

Closed
1 task done
wiwikuan opened this issue Jan 18, 2022 · 2 comments · Fixed by #2935
Closed
1 task done

Image relative path is relative to root folder that you open, not the file. #2901

wiwikuan opened this issue Jan 18, 2022 · 2 comments · Fixed by #2935
Labels
🔭 area/editor 🦋 optimization Improve the existing behavior

Comments

@wiwikuan
Copy link

wiwikuan commented Jan 18, 2022

Description

Image relative path is relative to the root folder that you open, not the file.

  • Can you reproduce the issue?

Steps to reproduce

  1. In preferences → image, I set "Prefer relative assets folder" to "On", and Relative image folder name to ..
  2. Let's say I have a project folder at /project, and I open that folder in Mark Text.
  3. I then edit a file at /project/some_folder/index.md
  4. I paste an image into it, and the image is copied to /project/image.jpg instead of /project/some_folder/image.jpg.

Expected behavior:

When setting relative image folder, it should be relative to the markdown file itself (Typora does that), not the project root folder.

Versions

  • MarkText version: 0.16.3
  • Operating system: macOS 10.14
@wiwikuan
Copy link
Author

I saw in #2826 we added the ${filename} variable, can we add ${currentFilePath} and ${projectRootPath}? That will easily solve this issue.

@fxha
Copy link
Contributor

fxha commented Jan 21, 2022

That's a good point and we should save the image relative to the opened file when a variable is used. This issue only occures if you opened a folder because all images are saved relative to the project root.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔭 area/editor 🦋 optimization Improve the existing behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants