note-refactor-obsidian icon indicating copy to clipboard operation
note-refactor-obsidian copied to clipboard

Add a command to merge notes

Open argenos opened this issue 5 years ago • 4 comments

If I want to merge note A into note B, I think a good starting place would be to append the contents of note A in note B and delete note A's file.

argenos avatar Nov 04 '20 17:11 argenos

Which of these are you thinking of to select note A, the source to merge into the target note, B?

  1. While editing note B, select note A from a picker (like the quick switcher).
  2. While editing note B, place the cursor over an internal link/embed for note A in note B.

In order to delete note A, there are other links to note A to consider to avoid orphaning the links. I think this would need to check if there are any existing links, embeds, block refs to note A other than from note B and, if there are, display a similar modal warning of existing links to that file as Obsidian core.

lynchjames avatar Nov 05 '20 18:11 lynchjames

Which of these are you thinking of to select note A, the source to merge into the target note, B?

While editing note B, select note A from a picker (like the quick switcher).

While editing note B, place the cursor over an internal link/embed for note A in note B.

I like the first option, but I can offer a third one (which I find more intuitive) ... having note A open as the active leaf, then selecting the command to move to note B (which is perhaps open in a different pane).

In order to delete note A, there are other links to note A to consider to avoid orphaning the links. I think this would need to check if there are any existing links, embeds, block refs to note A other than from note B and, if there are, display a similar modal warning of existing links to that file as Obsidian core.

This is a good point I hadn't considered. I think the warning is a very good starting point, eventually (maybe for a future iteration) and for practical purposes what we want is to substitute [[note A with [[note B in all the vault (as long as it's followed by either ]] or #. If that's the case, whatever comes after the file name ends can stay the same (]],#heading]] or #^blockref]]), right? I guess we're looking at a sligthly smart mass-search and replace.

argenos avatar Nov 05 '20 18:11 argenos

+1 to this feature. There is a thread about this subject on the Obsidian forum: https://forum.obsidian.md/t/whats-the-best-practice-for-merging-two-notes/6027

I believe the thread pre-dates Obsidian's block referencing / header referencing so that is a nuance that needs to be taken into consideration with any regexp vault search/replace.

dsteinbock avatar Dec 21 '20 04:12 dsteinbock

+1 for this feature too

IMO it could be implemented by first making first a "Move references to another note" (Ideally with support for aliases and section references)

May use case:

  • I have reference material from a cloud platform referencing the same service with a different name (Cloud XXXXX vs XXXX, I will miss it when reading and make a note for each
  • When reviewing it becomes apparent that only one note is necessary
  • I go to the note with "worst name" and run the command Move references to another note
  • I'm given a prompt for the new reference name
  • The plugin rename all reference of the "worst" name to the supplied one

Larandar avatar Mar 03 '21 11:03 Larandar