From 8d8d6d91aa8cdec49e7e6ef87cbc5622d0bc16ed Mon Sep 17 00:00:00 2001 From: MaheshtheDev <38828053+MaheshtheDev@users.noreply.github.com> Date: Mon, 3 Nov 2025 00:41:58 +0000 Subject: feat(browser-extension): webpages capture with markdown conversion (#548) Improved browser extension memory saving with better content handling and added markdown conversion. ### What changed? - Enhanced memory content handling in the background script to prioritize different content types (explicit content, highlighted text, markdown, HTML, or URL) - Added HTML to markdown conversion using TurndownService when saving entire pages - Improved HTML handling by removing script tags before processing - Updated the web app to display the saved URL from metadata when available - Added turndown library and its type definitions as dependencies --- apps/web/components/masonry-memory-list.tsx | 21 +++++++++++++++++---- apps/web/components/memories-utils/index.tsx | 3 +++ .../web/components/memories-utils/memory-detail.tsx | 2 +- 3 files changed, 21 insertions(+), 5 deletions(-) (limited to 'apps/web') diff --git a/apps/web/components/masonry-memory-list.tsx b/apps/web/components/masonry-memory-list.tsx index 16cd65c9..1a29093f 100644 --- a/apps/web/components/masonry-memory-list.tsx +++ b/apps/web/components/masonry-memory-list.tsx @@ -83,12 +83,25 @@ const DocumentCard = memo( ) } - if (document.url?.includes("https://")) { + // Check if this is a website document saved from the Chrome extension + const websiteUrl = + (document.metadata?.website_url as string | undefined) || + (document.url?.includes("https://") ? document.url : undefined) + + if (websiteUrl) { return ( onOpenDetails(document)} onDelete={() => onDelete(document)} /> diff --git a/apps/web/components/memories-utils/index.tsx b/apps/web/components/memories-utils/index.tsx index 3052f3c7..fca4d367 100644 --- a/apps/web/components/memories-utils/index.tsx +++ b/apps/web/components/memories-utils/index.tsx @@ -48,6 +48,9 @@ export const getSourceUrl = (document: DocumentWithMemories) => { if (document.type === "google_slide" && document.customId) { return `https://docs.google.com/presentation/d/${document.customId}` } + if(document.metadata?.website_url) { + return document.metadata?.website_url as string + } // Fallback to existing URL for all other document types return document.url } diff --git a/apps/web/components/memories-utils/memory-detail.tsx b/apps/web/components/memories-utils/memory-detail.tsx index 378d3f79..dbbc51cb 100644 --- a/apps/web/components/memories-utils/memory-detail.tsx +++ b/apps/web/components/memories-utils/memory-detail.tsx @@ -161,7 +161,7 @@ export const MemoryDetail = memo( {formatDate(document.createdAt)} - {document.url && ( + {(document.url || document.metadata?.website_url) && (