POSSE: SilverBullet: Feature Request: relative path for images #363
This is my POSSE copy of my comment on a SilverBullet issue, Feature Request: relative path for images #363.
I see the issue like this: SB is not the master of my files, it is a tool that I point at some of my files. It needs to play nicely with how other tools interpret my files. The “SB space root” is not special to anything else outside SB. I have many existing markdown files in subfolders. Only some of my files were created through SB. The rest of them were created by other tools that know nothing about SB, and don't expect their contained links to refer to SB's space root. They expect their relative paths to be relative to their own location in the filesystem.
Specifically I'm sometimes opening my files in Markor or QOwnNotes, and there's one subfolder that I pass to Eleventy to publish on my web site. None of these know or respect SB's space root.
It seems to me that other tools generally interpret a relative path in a markdown file as relative to the folder in which the markdown file is found. That is also the most intuitive interpretation. Adopting that convention will avoid problems in switching between different tools on the same files, syncing or deploying the files to another place, such as using them as input to a static site generator, for example.
As for Wiki-style links, on the other hand, I suppose being relative to “the wiki root” is the more established practice. However, it's cumbersome repeating the
Sub/Folder/ prefix when working on a bunch of related files in a sub-folder, so I'm looking for a shortcut for that case too. I propose allowing
./ as a shortcut meaning “here”, for this case.
- when SB is interpreting a Markdown link or HTML link found in a file:
- a relative path (doesn't begin with '/' or scheme) is relative to the folder containing the file.
- a path beginning with '/' is relative to the SB space root.
- when SB is interpreting a Wiki-style reference found in a file:
- an explicit './' relative path (begins with './') is relative to the folder containing the file.
- any other other Wiki-style path is relative to the SB space root.
In the file
<a href="baz"> refers toSPACE/Sub/Folder/baz`
<a href="./baz"> refers toSPACE/Sub/Folder/baz`
<a href="/baz"> refers toSPACE/baz`
For backward compatibility we need an option to maintain the old behaviour. I propose this should be a per-space setting and be set to “new behaviour” (by default, unless user opts out) when initialising any new SB space, and default to “old behaviour” when encountering any existing SB space.
How much sense does this all make to you all?
- email me:
- matrix me:
Donations gratefully accepted