decaf-dev / obsidian-note-splitter

Split a note into individual notes based on a delimiter
MIT License
12 stars 2 forks source link

Features: Options to delete original and save split notes to parent folder + minor fixes #2

Closed kitschpatrol closed 3 months ago

kitschpatrol commented 3 months ago

Hi, thanks for this plugin!

No obligation to merge this, but I made a few tweaks and fixes for my own use and thought I would share them back here in case they're of interest.

There are a few different things in this PR, each in their own commit.

Basically:

  1. Chore: Add automated formatting, but configured for the smallest diff from your original code as possible.

  2. Feat: Allow setting the "folder path" to an empty string to save split notes to their original parent folder. It can be nice to keep the split notes in their original context. This might benefit from more explicit UI in the settings tab, but overloading the blank field was quick and easy and moderately intuitive.

  3. Feat: Add option to deletion of the original split note if the split was successful. (E.g. number of notes save = number of notes expected.) This is on a new toggle in the settings tab.

  4. Fix: Trim the split notes earlier in the command callback so that no empty notes can get through.

    Say your delimiter is +++, and you have a note like this:

      +++
      Stuff
      +++

    I'd expect a single note containing "Stuff" in it after running the splitter command, but it was actually returning three notes, two of which were empty. Maybe preserving the empty notes is more honest, but ignoring them seemed more forgiving and likely to capture the user's intent.

Thanks again.