Skip to content

feat: prefer highest-resolution image from srcset over src fallback - #177

Closed
zagicat wants to merge 1 commit into
kepano:mainfrom
zagicat:main
Closed

zagicat wants to merge 1 commit into
kepano:mainfrom
zagicat:main

Conversation

@zagicat

@zagicat zagicat commented Mar 15, 2026

Copy link
Copy Markdown
Contributor

When an element has a srcset attribute with width descriptors, select the largest-width variant instead of the small fallback URL in src.

Sites like Substack serve article images via CDN with multiple resolutions in srcset (e.g. 424w, 848w, 1272w, 1456w) but set src to the smallest variant. This caused Obsidian Web Clipper to embed thumbnail-sized images even when full-width originals were available.

The parser tokenizes by whitespace rather than splitting on commas to handle CDN image URLs that embed comma-separated transform parameters directly in the URL path (e.g. Substack's w_424,c_limit,f_webp pattern).

Falls back to src when srcset is absent or contains no width descriptors (density-only srcsets like 1x/2x are not used for selection).

When an <img> element has a srcset attribute with width descriptors,
select the largest-width variant instead of the small fallback URL in src.

Sites like Substack serve article images via CDN with multiple resolutions
in srcset (e.g. 424w, 848w, 1272w, 1456w) but set src to the smallest
variant. This caused Obsidian Web Clipper to embed thumbnail-sized images
even when full-width originals were available.

The parser tokenizes by whitespace rather than splitting on commas to handle
CDN image URLs that embed comma-separated transform parameters directly in
the URL path (e.g. Substack's w_424,c_limit,f_webp pattern).

Falls back to src when srcset is absent or contains no width descriptors
(density-only srcsets like 1x/2x are not used for selection).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@kepano kepano closed this Mar 16, 2026
@kepano

kepano commented Mar 16, 2026

Copy link
Copy Markdown
Owner

Closed via c5adda3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants