append_to_note
Add content to existing notes in Obsidian vaults. Append text to files while maintaining formatting with optional newline control.
Instructions
Append content to the end of an existing note
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Relative path to the note | |
| content | Yes | Content to append | |
| ensureNewline | No | Ensure content starts on a new line (default: true) |
Implementation Reference
- src/lib/vault.ts:85-94 (handler)The appendToNote function, which implements the logic for appending content to a file.
export async function appendToNote( vaultPath: string, relativePath: string, content: string, ): Promise<void> { const fullPath = resolveVaultPath(vaultPath, relativePath); const existing = await fs.readFile(fullPath, "utf-8"); const separator = existing.endsWith("\n") ? "" : "\n"; await fs.writeFile(fullPath, existing + separator + content, "utf-8"); }