Skip to content

Render image outputs in presentation and dashboard layouts#49

Merged
TorreyBetts merged 2 commits into
DataficationSDK:mainfrom
eosfor:pr/presentation-image-outputs
May 7, 2026
Merged

Render image outputs in presentation and dashboard layouts#49
TorreyBetts merged 2 commits into
DataficationSDK:mainfrom
eosfor:pr/presentation-image-outputs

Conversation

@eosfor
Copy link
Copy Markdown
Contributor

@eosfor eosfor commented May 6, 2026

Problem

Notebook cells can produce raster image outputs such as image/png, but presentation and dashboard rendering paths did not handle image MIME types. In those layouts, image output could appear as raw base64 text instead of an image.

This is especially visible when plotting libraries save or display generated charts as image output and the notebook is switched into presentation mode.

Approach

Teach every presentation/dashboard output rendering path to treat image/* MIME types as data URI images, matching the behavior users already get in the regular notebook cell renderer.

Notable changes

  • Render image/* outputs as <img> elements in PresentationView.razor.
  • Render image/* outputs as <img> elements in DashboardCell.razor.
  • Add equivalent image output rendering to the HTML-producing PresentationLayout.
  • Preserve the existing handling for HTML, Markdown, plain text, and fallback MIME types.

Validation

  • dotnet build src/Verso.Blazor.Shared/Verso.Blazor.Shared.csproj --no-restore
  • dotnet build src/Verso/Verso.csproj --no-restore

Manual check

A notebook cell that outputs image/png now displays the image in presentation mode and dashboard cells instead of showing the base64 payload.

Review notes

This PR is scoped to rendering existing image outputs. It does not change execution, serialization, or output generation.

@TorreyBetts
Copy link
Copy Markdown
Contributor

PresentationLayout.cs uses StringComparison.OrdinalIgnoreCase on the StartsWith check, but DashboardCell.razor and PresentationView.razor use the default (culture-sensitive) comparison. Worth aligning on OrdinalIgnoreCase everywhere so MIME type matching is consistent across the three paths.

@TorreyBetts
Copy link
Copy Markdown
Contributor

Apologies for the conflict noise. We just merged a .gitattributes and line-ending normalization commit on main, which converted every text file from CRLF to LF. That intersects with all five of your recent PRs (#48, #49, #50, #51, #52), so each shows as conflicting even though most of the conflicts are line-ending only.

Easiest path per branch:

git fetch origin main
git rebase -Xrenormalize origin/main
git push --force-with-lease

The -Xrenormalize flag tells Git to canonicalize line endings on both sides before merging, which auto-resolves the line-ending conflicts. Anything that genuinely overlaps with other changes on main will still need manual resolution, but for these PRs that should be minimal.

@eosfor eosfor force-pushed the pr/presentation-image-outputs branch from 019847e to 8f9bbe9 Compare May 7, 2026 04:29
@eosfor
Copy link
Copy Markdown
Contributor Author

eosfor commented May 7, 2026

Rebased this branch onto current main with -Xrenormalize, force-pushed, and aligned the Blazor MIME checks to use StringComparison.OrdinalIgnoreCase as suggested. GitHub now reports it as mergeable.

Apologies for this, I hope I've done it right this time :D

@TorreyBetts
Copy link
Copy Markdown
Contributor

Thanks for catching this. I appreciate the contribution.

@TorreyBetts TorreyBetts merged commit aa253f6 into DataficationSDK:main May 7, 2026
4 of 5 checks passed
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.

2 participants