17 lines
469 B
TypeScript
17 lines
469 B
TypeScript
import { markdownToNoteHtml } from "../../utils/markdown";
|
|
|
|
export async function createChildNote(options: {
|
|
parentItem: Zotero.Item;
|
|
title: string;
|
|
bodyMarkdown: string;
|
|
}): Promise<Zotero.Item> {
|
|
const note = new Zotero.Item("note");
|
|
note.libraryID = options.parentItem.libraryID;
|
|
note.parentID = options.parentItem.id;
|
|
|
|
const html = markdownToNoteHtml(options.title, options.bodyMarkdown);
|
|
note.setNote(html);
|
|
await note.saveTx();
|
|
return note;
|
|
}
|