AutoYADM commit: 2024-12-03 18:35:03
This commit is contained in:
parent
2ff8fad2e3
commit
e5f8a2b615
1 changed files with 14 additions and 3 deletions
|
@ -8,14 +8,25 @@ local function resolver(document_path, image_path, fallback)
|
||||||
return fallback(document_path, image_path)
|
return fallback(document_path, image_path)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function tester(document_path, image_path, fallback)
|
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
|
-- my vault root
|
||||||
vim.env.NOTES_DIR = "/home/fic/second-brain"
|
vim.env.NOTES_DIR = "/home/fic/second-brain"
|
||||||
local working_dir = vim.fn.getcwd()
|
local working_dir = vim.fn.getcwd()
|
||||||
local notes_dir = vim.fn.expand(vim.env.NOTES_DIR)
|
local notes_dir = vim.fn.expand(vim.env.NOTES_DIR)
|
||||||
-- Format image path for Obsidian notes
|
-- Format image path for Obsidian notes
|
||||||
if working_dir:find(notes_dir, 1, true) then
|
if working_dir:find(notes_dir, 1, true) then
|
||||||
print((notes_dir .. "/" .. image_path))
|
|
||||||
return (notes_dir .. "/" .. image_path)
|
return (notes_dir .. "/" .. image_path)
|
||||||
end
|
end
|
||||||
-- Fallback to the default behavior
|
-- Fallback to the default behavior
|
||||||
|
@ -30,7 +41,7 @@ return {
|
||||||
integrations = {
|
integrations = {
|
||||||
markdown = {
|
markdown = {
|
||||||
enabled = true,
|
enabled = true,
|
||||||
resolve_image_path = tester,
|
resolve_image_path = resolver_ahmed,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue