Fix rendering of inline notebook content from ark#14150
Conversation
|
E2E Tests 🚀 |
PETE's assessment 🧪Verdict: 🔴 Insufficient -- a behavior-changing bug fix (Quarto inline HTML now routes through the raw-HTML webview path) ships with no regression test pinning the new path. What changed
Tests in this PR
Existing coverage
Suggested additions
Deployment note (optional)The underlying bug is webview script execution (UMD/AMD PETE (Positron Extreme Test Experiment) - LLM-based test-coverage advisor, in pilot. Triggers on PR open and on |
| // Render the self-contained HTML document directly in an overlay | ||
| // webview. We must NOT route this through `createNotebookOutputWebview`, | ||
| // which only builds a webview when an extension renderer is registered | ||
| // for the MIME type; plain `text/html` has none, so it falls back to | ||
| // the built-in renderer that strips `<head>` and scripts, leaving | ||
| // interactive widgets (plotly, leaflet) blank. The raw path injects the | ||
| // document verbatim with scripts enabled. This reaches us only for | ||
| // unsafe HTML (see `_renderHtml`/`_isSafeHtml`), i.e. exactly the | ||
| // script-bearing documents that need it. | ||
| const webview = await this._webviewService.createRawHtmlOutputWebview( | ||
| output.outputId, | ||
| content, | ||
| ); |
There was a problem hiding this comment.
Two notes:
- There is a 3rd arg for
baseUrithat may be useful, but I am not sure - The comment here seems a bit overly verbose
Both of these may be addressed by looking at the solution from
main...fix/quarto-inline-output-self-contained-webview
|
The two failing tests appears to be unrelated to this PR. They fail on some Posit AI chat button that we don't touch |
Fixes #4219
This PR and the related ark PR (posit-dev/ark#1215) should fix htmlwidget rendering in all notebook types.
There is one positron-side blocker related to inline quarto output that seems to be a bug in
quartoOutputViewZone._renderHtmlInWebview. It senst text/html throughcreateNotebookOutputWebview, which only builds a webview when an extension renderer is registered for the MIME type. text/html resolves to the built-in renderer, which strips<head>and scripts, resulting in blank output.The fix is to route the output through
createRawHtmlOutputWebview(outputId, content), which injects the document verbatim with scripts enabled (same path the Positron notebook uses).There shouldn't be any fallout from this change as this path is only ever reached for unsafe html without any mime renderer registered.
Testing
Release Notes
New Features
Bug Fixes
Validation Steps
@:ark@:jupyter@:quarto@:notebooks@:positron-notebooks@:web