diff --git a/notes/Implementation/new_event handler.js b/notes/Implementation/new_event handler.js index 98e1abe..a6711e1 100644 --- a/notes/Implementation/new_event handler.js +++ b/notes/Implementation/new_event handler.js @@ -32,9 +32,9 @@ const targetTemplate = await api.currentNote.getRelationValue('targetTemplate'); const options = { "parentNoteId": dayNote.noteId, "title": name, - "content": summaryHtml != "" ? summaryHtml : summary, + "content": summaryHtml != "" ? summaryHtml : summary.replace(/\n/g, "
").replace(/\r/g, ""), "type": "text", - "mime": summaryHtml != "" ? "text/html" : "text/plain" + "mime": "text/html" }; const resp = await api.createNewNote(options); const note = resp.note; diff --git a/src/main.rs b/src/main.rs index ac6c7d4..c77bdc7 100644 --- a/src/main.rs +++ b/src/main.rs @@ -142,8 +142,8 @@ async fn process_one(update: Update, context: &mut Context) -> Result<(), Error> if CLIENT.get(&trilium_url("/custom/new_event")).form(&json!({ "uid": calendar.events[0].uid, "name": calendar.events[0].summary, - "summary": calendar.events[0].description, - "summaryHtml": calendar.events[0].description_html.as_deref().unwrap_or_default(), + "summary": calendar.events[0].description.replace("\\n", "\n"), + "summaryHtml": calendar.events[0].description_html.as_deref().map(|x| x.replace("\\n", "\n")).unwrap_or_default(), "fileName": document.file_name, "fileData": text, "location": calendar.events[0].location,