(root: string, rel: string, body: string)
| 2650 | } |
| 2651 | |
| 2652 | export async function writeNote(root: string, rel: string, body: string): Promise<NoteMeta> { |
| 2653 | const abs = resolveSafe(root, rel) |
| 2654 | await fs.mkdir(path.dirname(abs), { recursive: true }) |
| 2655 | await fs.writeFile(abs, body, 'utf8') |
| 2656 | invalidateNoteMetaCache(root, rel) |
| 2657 | invalidateVaultTextSearchCache(root) |
| 2658 | const folder = folderOf(root, abs) |
| 2659 | if (!folder) throw new Error(`Note not in a known folder: ${rel}`) |
| 2660 | return await readMeta(root, abs, folder) |
| 2661 | } |
| 2662 | |
| 2663 | function normalizeNoteComment(input: NoteCommentInput, notePath: string): NoteComment | null { |
| 2664 | const body = typeof input.body === 'string' ? input.body.trim() : '' |
no test coverage detected