Perfect! The plan is now complete and ready for your review. Here's a summary of the implementation approach:
Summary
The plan implements image support in 5 phases:
- Data Structures - Add
AspectRatio, completeImagetype per lexicon, createUnresolvedImagefor parsing - Markdown Parser - Add
ImageInlinevariant, implement image parsing, lift images from inline to block level - Image Resolution - New module with
resolveImagefunction using JuicyPixels for decoding, handles files/URLs - Integration - Add
resolveDocumentImagesto fetch/upload images inpublishArticle/updateArticle - Testing - Comprehensive unit tests, parser tests, integration tests, error cases
Key Design Decisions
- UnresolvedImageBlock intermediate type - Cleanly separates parsing from resolution
- Relative paths use
_articleDir- Current working directory as base for relative file paths - Fail-fast on errors - Don't publish articles with failed image uploads
- JuicyPixels dependency - Well-established library for image decoding
- Comprehensive error types - Clear error messages for each failure mode
The plan is detailed enough to execute while remaining scannable. All critical files are identified with specific line numbers for changes.