AutoYADM commit: 2024-12-03 18:00:03

This commit is contained in:
Daniel Fichtinger 2024-12-03 18:00:03 -05:00
parent 1ee19f3ff0
commit 33f79bfd1d

View file

@ -8,6 +8,21 @@
-- hererocks = true, -- recommended if you do not have global installation of Lua 5.1. -- hererocks = true, -- recommended if you do not have global installation of Lua 5.1.
-- }, -- },
-- }) -- })
local function resolver(document_path, image_path, fallback)
local working_dir = vim.fn.getcwd()
-- Format path for Obsidian vault
if working_dir:find("/home/fic/second-brain", 1, true) then
-- if working_dir:find("~/second-brain/") then
local out = "Obsidian image: " .. working_dir .. "/" .. image_path
Snacks.notify.notify(out)
return working_dir .. "/" .. image_path
end
-- fallback to default
return fallback(document_path, image_path)
end
-- local function simple_resolver(document_path, image_path, fallback)
-- image_path = "/home/fic/second-brain"
-- end
return { return {
{ {
"3rd/image.nvim", "3rd/image.nvim",
@ -18,18 +33,7 @@ return {
markdown = { markdown = {
enabled = true, enabled = true,
-- From https://github.com/3rd/image.nvim/issues/190 -- From https://github.com/3rd/image.nvim/issues/190
-- resolve_image_path = function(document_path, image_path, fallback) resolve_image_path = resolver,
-- local working_dir = vim.fn.getcwd()
-- -- Format path for Obsidian vault
-- if working_dir:find("~/second-brain/", 1, true) then
-- -- if working_dir:find("~/second-brain/") then
-- local out = "Obsidian image: " .. working_dir .. "/" .. image_path
-- Snacks.notify.notify(out)
-- return working_dir .. "/" .. image_path
-- end
-- -- fallback to default
-- return fallback(document_path, image_path)
-- end,
}, },
}, },
}, },