Note Merger Plugin

Name

Note Merger

Description

Merge the contents and tasks of two notes

Icon

merge_type

Instructions

When prompted, this plugin will merge the contents and tasks of the current note with another note selected from the prompt box. Follow these steps:

1. From the note you want to merge with another note, open the note menu (three dots) and select "Note Merger"



2. In the dialogue window, select the note you want to merge the current note content with


3. Hit submit. The current note content will be added below the selected note content.


linkWishlist

Update backlinks from origin note to destination note



Add options to merge tags if desired



Add options to merge completed tasks if desired



Archive source note after merging




linkVersion History

1.0.0

Initial public release


linkCodeblock

{
async noteOption(app, noteUUID) {
 
// retrieve first note content and information
const noteHandle = await app.findNote({ uuid: noteUUID });
const content1 = await app.getNoteContent({ uuid: noteUUID });
const noteName1 = noteHandle.name;
const backLinks = await app.getNoteBacklinks({ uuid: noteUUID });
console.log(backLinks);
 
// retrieve second note content and information (i.e., the destination note)
const result = await app.prompt("Choose the note to merge with:", {
inputs: [
{ type: "note" }
]
});
if (result) {
const noteUUID2 = result.uuid;
const noteName2 = result.name;
const noteURL = await app.getNoteURL({ uuid: noteUUID2 });
const content2 = await app.getNoteContent({ uuid: noteUUID2 });
 
//Merge note contents
const newContent = content2 + "\n---\n# Merged content from " + noteName1 + "\n" + content1;
// console.log(newContent);
await app.replaceNoteContent({ uuid: noteUUID2 }, newContent);
 
await app.navigate(noteURL);
 
} else {
console.log("User cancelled action");
}
}
}