Skip to content

Notebooks: show JSON/HTML/markdown/JPEG/SVG outputs and markdown attachments - #13

Merged
TeleporterGuy merged 2 commits into
masterfrom
notebook-rich-outputs
Sep 28, 2026
Merged

TeleporterGuy merged 2 commits into
masterfrom
notebook-rich-outputs

Conversation

@TeleporterGuy

Copy link
Copy Markdown
Owner

Fixes the two gaps from Windows testing of the merged notebook changes:

  • Rich output invisible. 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.
  • Markdown attachment images broken. attachment:name references 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

TeleporterGuy and others added 2 commits September 28, 2026 22:17
…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>
@TeleporterGuy
TeleporterGuy merged commit 42a7893 into master Sep 28, 2026
4 checks passed
@TeleporterGuy
TeleporterGuy deleted the notebook-rich-outputs branch October 1, 2026 14:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant