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

This commit is contained in:
Daniel Fichtinger 2024-12-03 18:40:03 -05:00
parent e5f8a2b615
commit 372204f6c6

View file

@ -8,30 +8,6 @@ local function resolver(document_path, image_path, fallback)
return fallback(document_path, image_path) return fallback(document_path, image_path)
end end
local function resolver_ahmed(document_path, image_path, fallback)
-- my vault root
vim.env.NOTES_DIR = "/home/fic/second-brain"
local working_dir = vim.fn.getcwd()
local notes_dir = vim.fn.expand(vim.env.NOTES_DIR)
-- Format image path for Obsidian notes
if working_dir:find(notes_dir, 1, true) then
return vim.fn.shellescape(notes_dir .. "/" .. image_path)
end
-- Fallback to the default behavior
return fallback(document_path, image_path)
end
local function resolver_ahmed_fixed(document_path, image_path, fallback)
-- my vault root
vim.env.NOTES_DIR = "/home/fic/second-brain"
local working_dir = vim.fn.getcwd()
local notes_dir = vim.fn.expand(vim.env.NOTES_DIR)
-- Format image path for Obsidian notes
if working_dir:find(notes_dir, 1, true) then
return (notes_dir .. "/" .. image_path)
end
-- Fallback to the default behavior
return fallback(document_path, image_path)
end
return { return {
{ {
"3rd/image.nvim", "3rd/image.nvim",
@ -41,7 +17,7 @@ return {
integrations = { integrations = {
markdown = { markdown = {
enabled = true, enabled = true,
resolve_image_path = resolver_ahmed, resolve_image_path = resolver,
}, },
}, },
}, },