- Notifications
You must be signed in to change notification settings - Fork244
-
I recently found this awesome plugin! But I found myself unable to view the images in it. The solution that I found was aimage.nvim plugin, but from what I see obsidian ignores all path to the image and just uses image name. Is it possible to somehow integrate them?(or any other plugin with such functionality) |
BetaWas this translation helpful?Give feedback.
All reactions
❤️ 4
Replies: 3 comments 4 replies
-
Hey@Demianeen this is not on our roadmap, but if someone can find a clean way to integration it then I'd be happy to accept a PR! |
BetaWas this translation helpful?Give feedback.
All reactions
🚀 1
-
The solution I have for this is to have all of my images in an assets/images folder which is defined both in Obsidian and obsidian.nvim and then in the image.nvim setup have something like this markdown= {enabled=true,filetypes= {"markdown"},resolve_image_path=function(document_path,image_path,fallback)image_path="Path/to/vault"..image_pathreturnfallback(document_path,image_path)end, }, |
BetaWas this translation helpful?Give feedback.
All reactions
🚀 2
-
can you demonstrate how it works? Ive been looking for similar functionality! |
BetaWas this translation helpful?Give feedback.
All reactions
-
obsidianimages.mp4 |
BetaWas this translation helpful?Give feedback.
All reactions
-
Nice solution, and how do you get the image_path with multi-workspace? Suppose need get the para from obsidian.nvim in someway?@maxdulay |
BetaWas this translation helpful?Give feedback.
All reactions
-
If you do a |
BetaWas this translation helpful?Give feedback.
All reactions
-
The issue I see with your solution is that it will return an Obsidian-formatted path for any image inside a markdown document it encounters, even if the markdown file isn't inside your vault & the image path is just a regular relative path. |
BetaWas this translation helpful?Give feedback.
All reactions
-
The following solution will work whether you open the file directly, such as -- inside 'lua/plugins/image.lua'localfunctionresolver(document_path,image_path,fallback)localvault_dir="/path/to/your/vault"-- Check if the document is inside the vaultifdocument_path:find(vault_dir,1,true)then-- If so, return formatted path to imagereturnvault_dir.."/"..image_pathend-- fallback to default since not in vaultreturnfallback(document_path,image_path)endreturn { {"3rd/image.nvim",opts= {integrations= {markdown= {resolve_image_path=resolver, }, }, }, },} |
BetaWas this translation helpful?Give feedback.