feat. Implement bookmark metadata extraction and filtering system #3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
This PR implements a comprehensive system for extracting, processing, and filtering metadata from bookmark blocks in Notion. The implementation extends the Notion API SDK to transform standard bookmark blocks into enhanced notionpress_bookmark blocks with rich metadata.
Key Features
Type Extension: Added NotionpressBookmarkBlock type that extends standard Notion blocks with enhanced metadata capabilities
Metadata Extraction: Implemented HTML parsing using Cheerio to extract rich metadata from bookmarked web pages
Intelligent Default Fields: Set up default metadata fields (title, url, description, favicon, image) that are always included
Flexible Field Filtering: Added ability for users to specify which metadata fields to include via the --fields option
Error Handling: Robust error handling for URL fetching and HTML processing failures
Implementation Details
Created a clean, modular architecture for bookmark processing
Used preprocessors for consistent metadata cleaning and formatting
Ensured backward compatibility with the original Notion API
Implemented a recursive processing method to handle nested bookmark blocks
Fixed ESM module compatibility issues with proper file extensions
@Moon-DaeSeung