Repository navigation
Notebooks: show JSON/HTML/markdown/JPEG/SVG outputs and markdown attachments - #13
Merged
Merged
Conversation
…down attachments
Windows testing found two notebook contents that were saved correctly but
never displayed:
- Outputs without PNG or text/plain (e.g. display({...}, raw=True), which
is application/json only) rendered as nothing, so the cell looked empty.
Outputs now show, in order: PNG, JPEG, SVG, plain text, sanitized HTML,
markdown, pretty-printed JSON; anything else is named ("Output not shown
here: <mime>") instead of silently hidden. PNG-then-text stays first so
common outputs (pandas frames) look as before.
- Markdown cells' pasted images (`attachment:name`, bytes in the cell's
attachments) were broken images. The preview now rewrites them to data
URLs, which the markdown sanitizer and CSP allow.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
truncateMimeBundle (run in main on every kernel output) turned every
mime value into text; a JSON object became "". The kernel helper already
passes JSON mime values through and drops oversized ones, so keep them
as-is here. Found on Windows: display({'application/json': ...}, raw=True)
showed "" under the cell.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Fixes the two gaps from Windows testing of the merged notebook changes:
display({...}, raw=True)(application/json only) and other outputs without PNG / text/plain rendered nothing. Now: PNG, JPEG, SVG, plain text, sanitized HTML, markdown, pretty JSON; anything else is named instead of hidden. PNG-then-text order unchanged for common outputs.attachment:namereferences now resolve to data URLs from the cell's stored attachments.Tests:
tests/notebook-rich-output.test.tsx(display selection, JSON render, HTML sanitizing, attachment rewrite incl. through the real markdown sanitizer). Full suite, typecheck and lint pass.Worth offering upstream afterwards, since the same code is now in join3r/claude-project.
🤖 Generated with Claude Code