Soft delete notes

Hey guys :wave:
It would be nice to have a trash section where the deleted notes could lay around for a while before they’re actually deleted. Something similar to what happens with emails. What do you think? Is there any similar feature already?

Since we can use the #meta or #template tag to hide the notes from the Page Picker (but show them in the Meta Picker), I would say that #trash or #hidden or #archive tag would be a reasonable way to hide them from both.

The way I imagine it, they would stay in this state indefinitely, but let’s say that links to them are crossed out. In case you’d want to delete them, you would find them all with something like this:

```query
trash
render each [[Library/Core/Query/Page]]
```

I personally think this feature isn’t implemented, because you’re really expected to have a backup (I use git). Then delete anything immediately, knowing that you would be able to back to it if you change your mind.

Aaaand I realised you can have part of this today, by adding this in SETTINGS:

pageDecorations:
- where: "tags = 'trash'"
  prefix: "🚮 "
1 Like

I did this recently for the #hidden tag, I’m not sure if I like hardcoding another special word in the code. At least you can try it out now.

1 Like

how’s the best way to test this out?
I would like to do it using docker. How can I build the docker image from the dockerfile? I’l missing the dist folder :sweat_smile:

1 Like

Thank you @zef! :ok_hand:

I’m not sure if I’m testing this correctly but I’m not seeing any difference in behaviour.

Here’s the steps I did:

  1. ran docker run -it -p 3000:3000 -v ./space:/space zefhemel/silverbullet:edge
  2. Open localhost:3000
  3. create note1
  4. create note2
  5. tagged note2 in note1 page
  6. delete note2

then I checked if the file exists and it doesn’t, it was deleted.
How would I soft delete it? adding the trash tag to frontmatter?

To allow you to choose your own tag, now this is specified using Page Decorations

Sorry, forgot to say about the change here.

I see, so the idea is to add this :point_down: page decorator

Then, instead of deleting pages, we add the #trash tag, is that it?
It sounds ok, but the problem is that it still appears on “open” and search screens, no?

It has to be:

pageDecorations:
- where: "tags = 'trash'"
  prefix: "🚮 "
  hide: true

If you just want to hide them you can omit the prefix line

1 Like

Idea that keeps coming back: in addition to space script and space style, also add space setting, which would allow you to distribute SETTINGS across pages (and potentially in a Library) and would do a smart deep merge of all those settings. This would allow distribution of a pattern like this “trash note” to be distributed via a Library and group things that require a combination of script, style and settings on a single (meta) page.

3 Likes

And how does the workflow looks like? Instead of using the delete command, I have to add the trash tag, right?

This reminds me of how astronvim is managing the plugin configuration and user configuration. They allow settings to be written/modified lua tables everywhere in the astronvim setup, then merge and ensure that user’s configuration is loaded at final merge.

It is the most comfortable neovim distribution I’ve came across so far and I would say similar idea might work also well on silverbullet.

Yup.

I don’t know if it would be possible to create a command which adds the trash tag via an SB syscall, but I guess that might be a better workflow.

Yes, you can do it in frontmatter, or by having a paragraph which has tags only (see Objects#Tags).

It definitely would be possible, but I don’t think it’s worth it now, since we don’t have autocomplete in command prompts, I just described it briefly towards the end of that post: Folder auto complete - #5 by Maarrk. Since the completion in frontmatter could be improved (#736), I think that just writing #trash in a paragraph is the most convenient solution for now.