diff --git a/src/database/Highlight.test.ts b/src/database/Highlight.test.ts index f36aeb6..16db320 100644 --- a/src/database/Highlight.test.ts +++ b/src/database/Highlight.test.ts @@ -55,9 +55,7 @@ describe('HighlightService', async function () { ## Chapter Eight: Holden -“I guess I can’t be. How do you prove a negative?” - [[2022-08-05T20:46:41+00:00]] - -` +> “I guess I can’t be. How do you prove a negative?” — [[2022-08-05T20:46:41+00:00]]` ) }); @@ -85,9 +83,7 @@ describe('HighlightService', async function () { ## Chapter Eight: Holden -“I guess I can’t be. How do you prove a negative?” - -` +> “I guess I can’t be. How do you prove a negative?”` ) }); diff --git a/src/database/Highlight.ts b/src/database/Highlight.ts index de26804..d115f83 100644 --- a/src/database/Highlight.ts +++ b/src/database/Highlight.ts @@ -21,10 +21,14 @@ export class HighlightService { markdown += `\n\n` } - return markdown + return markdown.trim() } - convertToMap(arr: Highlight[], includeDate: boolean, dateFormat: string): Map> { + convertToMap( + arr: Highlight[], + includeDate: boolean, + dateFormat: string, + ): Map> { const m = new Map>() arr.forEach(x => { @@ -32,10 +36,14 @@ export class HighlightService { throw new Error("bookTitle must be set") } - let text = x.bookmark.text + let text = `> ${x.bookmark.text}` + + if (x.bookmark.note) { + text += `\n\n ${x.bookmark.note}` + } if (includeDate) { - text = text + ` - [[${moment(x.bookmark.dateCreated).format(dateFormat)}]]` + text += ` — [[${moment(x.bookmark.dateCreated).format(dateFormat)}]]` } const existingBook = m.get(x.content.bookTitle)