Repository navigation
Gallery: one screenshot as HTML or Markdown (JS reference, SPEC, fixtures) (sc-9561) - #291
Merged
Merged
Conversation
ndbroadbent
marked this pull request as ready for review
December 5, 2026 10:27
ndbroadbent
force-pushed
the
gallery-screenshot
branch
from
December 5, 2026 14:10
75c4ffb to
48c6077
Compare
…k shot for dark readers (sc-9561) screenshot() and screenshotMarkdown() in the JS library, the reference for the other renderers: the SPEC's "A single screenshot" section and its fixtures in contract/screenshots (cases with their HTML and Markdown, and refusals).
…can't end the Markdown image or HTML block; the SPEC names the gallery's messages for dimensions and groups (review)
…, thumbs only when every image shown has one, no dark source that's the same image; more fixtures (independent review)
ndbroadbent
force-pushed
the
gallery-screenshot
branch
from
December 5, 2026 15:30
48c6077 to
3e8a710
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
One screenshot from a gallery manifest, for a page or a README:
screenshot(manifest, options)gives HTML,screenshotMarkdown(manifest, options)gives Markdown. Part of sc-9561. This is the JS reference, the SPEC section and the contract fixtures. The Ruby, Python, Rust and Hugo ports, the components and the docs page follow in later PRs.themegiven and a dark shot for the screen, a<picture>with a<source media="(prefers-color-scheme: dark)">, so dark readers (GitHub's dark mode included) see the dark shot. Otherwise a plain<img>(withsrcsetwhen there's a 2x copy). Markdown gives(or[](original)), and the<picture>HTML when there's a dark shot.screen(required),group,theme,size,alt,link,thumb,loading(lazy or eager), and the gallery'sdimensionsandgroups.buildModelruns on a manifest of the chosen group's items for that screen, so names pair exactly as they do in the gallery, and the gallery's errors apply to this screen alone. A screen with only 2x shots shows them at half size; otherwise its images are exactly the gallery's. Thumbs are used only when every image shown has one, and a dark source that is the same image is left out.checkManifestanddimensionsOption(thedimensionsoption checked and resolved;buildModeluses it too). No behaviour change.contract/screenshots): one manifest, 20 cases, each with exact.htmland.mdoutput (2x srcset, thumbs and mixed thumbs, 2x-only halving to odd sizes and past a name's width, a stray 2x shot, a theme-less screen, a custom dimension, thegroupsoption, a duplicate group name, line breaks in alt, and escaping in alt and URL for both forms). 21 refusals with their messages, including the order of checks.Nothing visible on the site yet. The changelog line comes with the docs page.