Smart filename path resolve

Hi, I just found a missing piece in Silvebullet: smart resolve of filename without specifying the whole directory. This is actually there in Obsidian which means if the filename is found inside the space and there is no ambiguity, then you don’t need to specify the whole directory and the link is actually valid.

Why I need it? I recently figure out a way to maintain my public note inside Silverbullet by putting them into a Publish directory inside my notes, which are also obsidian link compatible markdowns published via quartz (I’ll have a separate post later to share how I make this working for me). But this creates a discrepancy when we don’t have the smart path resolve – the root of that published note is actually different from the Silverbullet space. Take example [[Note1]] is a valid link for both published note and Sb if there is such smart filename resolve. But [[Publish/Note1]] is only valid for Silverbullet and is the only supported format yet in SB.

Is it hard to implement? Well, I must admit it is harder for me to implement since I don’t know JS and web development, but the logic seems very straight forward: resolve those links that 1) doesn’t have parent folder, 2) with the same filename found inside the space and 3) not ambiguous (only one of the same filename found). So I assume it should be quite easily integrated into SB.

I want to know what is your opinion on this and if someone with the web knowledge would like to implement this. But I would also like to investigate into it if none takes over. I haven’t yet look into the repo so I might miss some complexity here.

Ok, this has come up before. I wrote this up before, but cannot really find it anymore.

In Obsidian you can indeed use “global” page links. Indeed, if you have a People/John page, you can link to it simply via [[John]]. It does not matter if that page is top level of buried deep in a folder structure.

This is nice, until you have two pages named John. If I remember correctly, what Obsidian then does the moment you create a second John page, is update all your notes and turns all John links into absolute links, so you’d get People/John and More People/John links in that case. So now some of your links are “clean” and others have the prefix. This works, but… I’m not a fan. Hence SB’s simpler approach of going absolute always.

Now what’s still possible is to support resolving links to pages in the Obsidian style, and attempt to dynamically figure out their full paths. However, the only real use case I see for that is when you import an Obsidian vault into SilverBullet. The moment you create a new page link (likely with auto complete), what style should the page link auto complete to?

What you probably want (to support Quartz) is that actually SB adheres to the “global” page link approach, and basically needs to implement all associated Obsidian behavior (including updating page references when ambiguity is created) which I personally think is somewhat flawed.

Theoretically you could have “modes” where you pick one of two link styles, but that’s a maintenance nightmare.

1 Like

Hi Zef, I also vaguely remember the discussion happened but failed to find it.

Yes, I understand the problem of it and I also think it would be hard to make sure compatible with Obsidian. TBH I don’t think we need 100% compatibility with Obsidian at all.

What I envision would be a simplier version of it: 1) we only implement the resolve logic, not the logic to create short version of it, we just default to our most comfortable behavior for now which is full path 2) we make the link unresolved/not found when multiple of the same name are found, or we can do some heuristics on resolving links: we resolve to the link in Breadth First Search manner with alphabetical order on search (this gives us very deterministic answer on to which file the link would be resolved). I mean the point is to make our live easier and have the benefit and in the meantime no need to have 100% obsidian compatibility.