It looks like linking to the same file might cause problems?
Like, I can see that generate_links() is able to pass nil as the file to get_linkables() here:
local file_inserted = (function()
if vim.api.nvim_get_current_buf() == bufnr then
return nil
else
return Path(file)
end
end)()
local links = get_linkables(bufnr, file_inserted, Path(current_workspace[2]))
local function get_linkables(bufnr, file, workspace)
local ret = {}
local path
local lines
if file then
lines = vim.fn.readfile(file:tostring("/"))
path = file
file = "$/" .. file:relative_to(workspace):remove_suffix(".norg")
else
lines = vim.api.nvim_buf_get_lines(bufnr, 0, -1, true)
end
--- ...
table.insert(
ret,
{ line = i, linkable = marker_or_drawer[2], display = marker_or_drawer[1], file = file, path = path }
)
end
end
return ret
And then those values are the values passed to entry maker I think?
from the issue discussed on discord.
Here's some context from discord:
It looks like linking to the same file might cause problems? Like, I can see that generate_links() is able to pass nil as the file to get_linkables() here:
And then those values are the values passed to entry maker I think?