From cbde0dfbd3c53d97ac34d0f37aede868c9d5f6e4 Mon Sep 17 00:00:00 2001 From: Dan Connolly Date: Wed, 7 Oct 2026 08:31:07 -0500 Subject: [PATCH] fixup! diigo-cache: RSS in diigo's export shape, from cached items A diigo note item's body (note_content) renders first, as a Highlight: line, as the export does: the 6 "export has notes, cache none" items from the comparison were notes whose bodies the cache had all along. Generated-by: Claude Opus 5.5 --- diigo-cache/src/rss.ts | 6 ++++-- diigo-cache/tests/rss.test.ts | 6 ++++++ 2 files changed, 10 insertions(+), 2 deletions(-) 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:",