diff options
| author | MaheshtheDev <[email protected]> | 2025-11-03 00:41:58 +0000 |
|---|---|---|
| committer | MaheshtheDev <[email protected]> | 2025-11-03 00:41:59 +0000 |
| commit | 8d8d6d91aa8cdec49e7e6ef87cbc5622d0bc16ed (patch) | |
| tree | 27862f7558d837615d2af6cea8c30ea03d414096 /apps/web/components | |
| parent | chore: update readme with recent updates and latest demo (#547) (diff) | |
| download | supermemory-8d8d6d91aa8cdec49e7e6ef87cbc5622d0bc16ed.tar.xz supermemory-8d8d6d91aa8cdec49e7e6ef87cbc5622d0bc16ed.zip | |
feat(browser-extension): webpages capture with markdown conversion (#548)10-31-feat_browser-extension_webpages_capture_with_markdown_conversion
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
Diffstat (limited to 'apps/web/components')
| -rw-r--r-- | apps/web/components/masonry-memory-list.tsx | 21 | ||||
| -rw-r--r-- | apps/web/components/memories-utils/index.tsx | 3 | ||||
| -rw-r--r-- | apps/web/components/memories-utils/memory-detail.tsx | 2 |
3 files changed, 21 insertions, 5 deletions
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 ( <WebsiteCard - url={document.url} - title={document.title || "Untitled Document"} - image={document.ogImage} + url={websiteUrl} + title={ + (document.metadata?.website_title as string | undefined) || + document.title || + "Untitled Document" + } + image={ + (document.metadata?.website_og_image as string | undefined) || + document.ogImage + } + description={document.content && typeof document.content === "string" ? document.content : undefined} onOpenDetails={() => 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( <span>{formatDate(document.createdAt)}</span> </div> </div> - {document.url && ( + {(document.url || document.metadata?.website_url) && ( <div className="flex items-end"> <Button onClick={() => { |