correctly insert image paths with ObsidianPasteImg for notes in subdirectories #190
svenXY
announced in
Announcements
Replies: 3 comments
-
Thanks this is very helpful! |
Beta Was this translation helpful? Give feedback.
0 replies
-
I see the issue here, but I am not sure how will it be helpful, since:
|
Beta Was this translation helpful? Give feedback.
0 replies
-
I have opened an issue #189 tracking the path issue, thank you for your great input. I will convert this to a discussion so that folks with need can see this. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
🚀 The feature, motivation and pitch
This is a possible solution to insert correct links with ObsidianPasteImg when using it in notes that reside in subdirectories of vaults.
Currently, when pasting an image into a note, the link that is inserted into the document only works if the note is in the topmost directory of an obsidian vault ( it will be assets_dir .. image.png).
But if the note is in a subdirectory of the vault, this will be incorrect and will not resolve properly.
For example, for a file in /home/me/vaults/work/foo/bar/mynote.md, the path relative to the vault root would have to be ../../assets/imgs/myimage.png and not assets/imgs/myimage.png
A patched img_text_func could for example look like this:
This would still support absolute paths and it would not interfere with notes in the vault top directory (leaving them unchanged). I think this could be the default implementation, otherwise maybe it could be mentioned in the help file.
Beta Was this translation helpful? Give feedback.
All reactions