Repository navigation
docs: OG cards show each page's method result or icon, and fit long titles - #1563
Merged
Merged
Conversation
A one-word title wider than the text column, like measureTextHeight(), can't wrap, so it pushed Jimpy's column right and clipped him. The title size now also needs its longest word (measured with measureText) to fit, and the text column has minWidth 0 so nothing in it can push Jimpy. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Method cards show the method applied to the playground's dice photo, made at build time by the same playground op as the method's sticker on /methods/. Guides, concepts and methods with nothing to picture show the page's own sticker icon from icons.ts, drawn large with plugin-draw on a tile in the page's color. Jimpy peeks out from the corner of both. The install line now comes from jimp's dependencies, so pages about packages outside jimp (like @jimp/plugin-shadow) install those. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
SVG fills a path black unless it says otherwise, so line paths without fill="none" filled the shapes they enclose: the WASM icon's W, the EXIF camera's top, the large-images arrowheads and the browser's chevrons. The site and the OG cards both draw them as lines now. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Collaborator
Author
|
🚀 PR was released in |
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.
Two changes to the docs' generated Open Graph cards (#1562).
1. Each card shows its page's subject, not always Jimpy
Every card used to have the same big Jimpy, so they all looked alike. Now each card shows something about its page:
/methods/, run at build time with a context that readspublic/from disk (src/og/preview.ts).read,hash,intToRGBA, …), the type reference, the method index and the playground. The icon is drawn large on a tile in the page's color, like the cards on the home page. A method's icon is chosen the way/methods/chooses it: its own, then its op's, then its category's.src/og/icon.tsdraws the icons straight from the markup insrc/components/icons.tswith plugin-draw. It handles the small SVG subset those icons use:path,rect,circle,g, fill, stroke, width, caps, joins, opacity and dashes. It isn't an SVG renderer and adds no dependencies.Icon fix (site and cards): four icons had line paths without
fill="none", so SVG's default black fill filled the shapes they enclose: the WASM icon's "W", the EXIF camera's top, the Reading Large Images arrowheads (solid, now open) and the browser's< >chevrons. They now havefill="none", the convention the rest oficons.tsuses. I checked this by measuring the enclosed area of every unfilled stroked path inicons.ts; none are left.printandmeasureTextshow their icon rather than a picture, because their op loads fonts over HTTP, which doesn't work at build time.roundCornersturns its thumbnail off on purpose, so it shows its icon too.The install line now comes from
jimp's own dependencies instead of a hand-written list. For exampleshadow()now saysnpm install @jimp/plugin-shadow.2. Long one-word titles no longer push the picture aside
On 4 cards (
measure-text-height,encode-frames,write-frames,distance-from-hash) the method name was wider than the text column. A single word can't wrap, so it pushed Ji 8000 mpy's column right and the card's edge clipped him. The title now also shrinks until its longest word, measured withmeasureText, fits. The text column hasminWidth={0}as a backstop.Checked
methods/resize.png's does.🤖 Generated with Claude Code