feat: rich notebook previews through OpenGraph metadata#8097
Merged
mscolnick merged 10 commits intomarimo-team:mainfrom Feb 4, 2026
Merged
feat: rich notebook previews through OpenGraph metadata#8097mscolnick merged 10 commits intomarimo-team:mainfrom
mscolnick merged 10 commits intomarimo-team:mainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
mscolnick
reviewed
Feb 3, 2026
mscolnick
reviewed
Feb 3, 2026
mscolnick
reviewed
Feb 3, 2026
Contributor
mscolnick
left a comment
There was a problem hiding this comment.
this is great! few small comments
we can do this in a followup, but will need to update the docs as well.
Light2Dark
reviewed
Feb 4, 2026
Contributor
Author
Thanks for the feedback. would it be ok to update docs in a separate PR? |
mscolnick
approved these changes
Feb 4, 2026
mscolnick
pushed a commit
that referenced
this pull request
Feb 10, 2026
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.
📝 Summary
Adds notebook-level OpenGraph metadata (PEP 723 + Next.js-inspired optional generator hook) with thumbnail generation plumbing. As a first use case, wired it up to improve gallery cards in
marimo run <dir>.Follow-up of #8056.
🔍 Description of Changes
OpenGraphMetadatafor notebooks via PEP 723:[tool.marimo.opengraph]withtitle,description,image, and optionalgeneratorimagesupports either an HTTPS URL or a notebook-relative pathGET /api/home/thumbnail?file=...__marimo__/directoryog:title,og:description,og:image)FileInfo.opengraph(title/description/image) and fall back to the existing title-casing behaviormarimo tools thumbnails generate ...to write thumbnails to__marimo__/assets/<stem>/opengraph.png--no-execute(fast; no cell outputs)--executeto include outputs--sandbox(only applies with--execute)📸 Thumbnails
Auto-generated thumbnails without
playwrightNo file gets written to disk. The
/thumbnailAPI endpoint callsDEFAULT_OPENGRAPH_PLACEHOLDER_IMAGE_GENERATORto construct an SVG dynamically and serves it.Auto-generated thumbnails with
playwright, but without notebook executionRenders code blocks without outputs, similar to Observable, as suggested by @manzt.
Auto-generated thumbnails with
playwright, with sandboxed notebook execution for cell outputs⚡️ Generators
Users can define custom functions to return OG metadata based on bespoke logic.
Below an example of a notebook (1) defining
generator = "generate_opengraph"in PEP 723 then (2) implementingdef generate_opengraph(context, parent):as@app.functionto return the metadata dynamically, yielding a custom card from with image from https://placehold.co/1200x630/png.