````
const headerRegex = /##### Next Session:?\s*\n([\s\S]*?)(?=\n#+|$)/;
const headerMatch = previousNoteContent.match(headerRegex);
if (headerMatch) {
const nextSessionText = headerMatch[1].trim();
const currentNoteContent = await app.vault.read(file);
// **Find the "> [!todo] From Last Session:" callout in the current note**
const insertionRegex = />\s*\[!todo\]\s*From Last Session:/;
const insertionMatch = currentNoteContent.match(insertionRegex);
if (insertionMatch) {
// Find where the callout line ends
const insertionIndex = currentNoteContent.indexOf(insertionMatch[0]) + insertionMatch[0].length;
// Format the text so each line begins with ">"
const formattedText = nextSessionText.split("\n").map(line => `> ${line}`).join("\n");
// Insert the formatted text below the callout
const newContent =
currentNoteContent.slice(0, insertionIndex) + "\n" + formattedText + "\n" +
currentNoteContent.slice(insertionIndex);
await app.vault.modify(file, newContent);
} else {
new Notice('Could not find "> [!todo] From Last Session:" in current note.');
}
} else {
new Notice('Could not find "##### Next Session:" header in previous note.');
}