diff --git a/diigo-cache/src/rss.ts b/diigo-cache/src/rss.ts index 303225b..d32ed59 100644 --- a/diigo-cache/src/rss.ts +++ b/diigo-cache/src/rss.ts @@ -24,14 +24,16 @@ const list = (v: unknown): Record[] => (Array.isArray(v) ? (v a * `Tags:a,b;Description:…;Annotations and Sticky notes:…` — tags * comma-separated (`no_tag` when none), then each highlight as * `Highlight:\n` followed by its sticky notes, one - * `Sticky notes:\n` each (notes may span lines) + * `Sticky notes:\n` each (notes may span lines). A diigo *note* + * item's body (`note_content`) comes first, as a `Highlight:` line. */ export function itemDescription(item: Item): string { const tags = str(item.tags) || "no_tag"; + const body = str(item.note_content) ? `Highlight:${str(item.note_content)}\n` : ""; const notes = list(item.annotations) .map((a) => `Highlight:${str(a.content)}\n${list(a.stickyNotes).map((n) => `Sticky notes:${str(n.content)}\n`).join("")}`) .join(""); - return `Tags:${tags};Description:${str(item.description)};Annotations and Sticky notes:${notes}`; + return `Tags:${tags};Description:${str(item.description)};Annotations and Sticky notes:${body}${notes}`; } /** one ``: title, link, packed description. The title is whole diff --git a/diigo-cache/tests/rss.test.ts b/diigo-cache/tests/rss.test.ts index d1986ab..831a9ba 100644 --- a/diigo-cache/tests/rss.test.ts +++ b/diigo-cache/tests/rss.test.ts @@ -21,6 +21,12 @@ describe("itemDescription", () => { ); }); + it("renders a note item's body as a Highlight line, as diigo's export does", () => { + expect(itemDescription({ type_name: "note", tags: "", description: "", note_content: "the note", annotations: [] })).toBe( + "Tags:no_tag;Description:;Annotations and Sticky notes:Highlight:the note\n", + ); + }); + it("says no_tag when there are no tags, and leaves empty parts empty", () => { expect(itemDescription({ tags: "", description: "", annotations: [] })).toBe( "Tags:no_tag;Description:;Annotations and Sticky notes:",