feat: Output Altair SVG charts as base64-encoded images#8443
Merged
mscolnick merged 1 commit intomarimo-team:mainfrom Feb 25, 2026
Merged
feat: Output Altair SVG charts as base64-encoded images#8443mscolnick merged 1 commit intomarimo-team:mainfrom
mscolnick merged 1 commit intomarimo-team:mainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
mscolnick
approved these changes
Feb 24, 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
This pull request modifies the
AltairFormatterto output SVG charts as base64-encoded data URIs.Currently, Altair SVG charts are rendered as raw
<svg>elements, which prevents users from easily saving or dragging the chart as an image file. This change encodes the SVG output into adata:image/svg+xml;base64,...URI, which the frontend then renders as an<img>tag.This improves the user experience by allowing Altair SVG charts to be dragged and dropped or saved as image files directly from the browser.
Note: This change only impacts users who explicitly opt-in with
altair.renderers.enable("svg"). There is no change to the default behavior.Closes #8400
🔍 Description of Changes
marimo/_output/formatters/altair_formatters.pyto base64-encode SVG string outputs and format them as a data URI.tests/_output/formatters/test_altair_formatters.pyto assert the new data URI format.Current behavior: Altair SVG as raw
<svg>(lacks image context menu)After this PR: Altair SVG as Base64-encoded
<img>(provides image context menu)📋 Checklist