generate-workspace-summary doesn't generate links properly on Windows
Prerequisites
- [X] I am using the latest stable release of Neovim
- [X] I am using the latest version of the plugin
Neovim Version
0.9.1
Neorg setup
config = function()
require("neorg").setup {
load = {
["core.defaults"] = {}, -- Loads default behaviour
["core.concealer"] = {
config = {
icon_preset = "basic",
},
}, -- Adds pretty icons to your documents
["core.dirman"] = { -- Manages Neorg workspaces
config = {
workspaces = {
notes = "~/notes",
my_workspace = "~/path/to/my-workspace",
},
},
},
["core.summary"] = {},
},
}
end,
Actual behavior
When I go into a workspace that is not the main notes workspace, the generate-workspace-summary command does not generate the links properly. For instance, if my workspace's file structure looks like this:
my-workspace/
index.norg
notes/
file1.norg
file2.norg
And I use the command in the index.norg file, the output will be:
* Index
** Uncategorized
- {:$C:\Users\username\path\to\my-workspace\index:}[Index]
- {:$C:\Users\username\path\to\my-workspace\notes/file1.norg:}[File 1]
- {:$C:\Users\username\path\to\my-workspace\notes/file2.norg:}[File 2]
On top of the structure of the links being wrong (i.e. not starting from the root of the workspace), they simply don't work, probably because of the colon after C: and also possibly because of the mix of backslashes and slashes.
Expected behavior
The output of the command should be:
* Index
** Uncategorized
- {:$/index:}[Index]
- {:$/notes/file1.norg:}[File 1]
- {:$/notes/file2.norg:}[File 2]
Steps to reproduce
Execute the generate-workspace-summary command in a workspace that is not the main notes workspace, on Windows.
Potentially conflicting plugins
No response
Other information
I'm on Windows 11.
Also, everything seems to work as intended in my main notes workspace located at ~/notes (i.e. C:\Users\username\notes).
Help
Yes, but I don't know how to start. I would need guidance (check question below)
Implementation help
I'd be willing to, but I've never written Lua except for my (quite basic) neovim configuration, and I've obviously also never worked on a neovim plugin, so unless it's a rather small or straightforward fix, I doubt I'd be able to help.
I think I know where the problem is ... https://github.com/nvim-neorg/neorg/blob/main/lua/neorg/modules/core/summary/module.lua#L93-L93
It's trying to take a full path to the norg file, and strip out the workspace location from the start of it. Probably the workspace location is in a slightly different format to the filename.
This is just a reckon rather than a proper analysis. Maybe it's been configured to point to ~/<my-dir>, maybe it's forward slashes, IDK. ... possibly you could fix this locally by configuring your workspace using the full path to your workspace directory.
Of course we should find a way to normalise these 2 paths in a cross-platform way.