silverbulletmd / silverbullet

The hackable notebook
https://silverbullet.md
MIT License
2.01k stars 138 forks source link

Feature Request: make attachments(images) folder configurable #884

Open ptbsare opened 3 weeks ago

ptbsare commented 3 weeks ago

Hi, great markdown note taking app ! Is there any way that I can upload/paste/drag-drop a image to a folder other than the space folder. Currently you can only upload all the images to the space folder, which is very hard to organize if you have many notes. What I want is that when I upload/paste/drag-drop a image, the file will be automaticly saved to a folder of the same name to the markdown file (or page title or whatever configurable ). E.G

test.md
test/Screenshot.png
posts/viva-la-vida.md
posts/viva-la-vida/Screen-shot.png

auto insert this in viva-la-vida.md :
![](viva-la-vida/Screen-shot.png)

In the beginning I wanted to write a plug to do this. But it seems that plug-ins cannot override the editor's drop/paste image behavior?

Very nice app ! : )

zefhemel commented 2 weeks ago

This is indeed not something you can implement with a plug, nor configure. What it does right now is always put the attachment in the same folder as the page it's dragged in. I can indeed imagine you'd like this to work differently.

I'm now thinking what should be the options here:

Maybe other options?

ptbsare commented 2 weeks ago

Personally, I think the path should be something that is configurable, like the VSCode way, which is most flexiable: Screen Shot 2024-06-13 at 18 30 45 If that is too overkill. Maybe like the Typora way (the $fileName folder is enough): image

Ref: https://support.typora.io/Images/

Any thoughts? Many thanks for the efforts to improve this. : )

tmichela commented 2 weeks ago

I think the most important is to ensure links to attachments are preserved if the note is renamed. Right now it would break if you rename the note such that it ends up in a different directory.

zefhemel commented 2 weeks ago

@tmichela in the current edge builds (not yet properly released) work was already done to rename and move attachments as pages are renamed as well. That would then also have to be made to work whatever settings we add here.

tmichela commented 2 weeks ago

Oh sweet! will switch to edge

zefhemel commented 2 weeks ago

Credit for that work goes 100% to @onespaceman btw