MCPcopy Create free account
hub / github.com/deepnote/vscode-deepnote / renderOutput

Method renderOutput

src/renderers/client/render.tsx:267–284  ·  view source on GitHub ↗
(data: nbformat.MultilineString | PartialJSONObject, mimeType?: string)

Source from the content-addressed store, hash-verified

265 );
266 }
267 private renderOutput(data: nbformat.MultilineString | PartialJSONObject, mimeType?: string) {
268 // eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-unused-vars, no-unused-vars, @typescript-eslint/no-explicit-any
269 const Transform: any = getTransform(this.props.mimeType!);
270 const vegaPlot = mimeType && isVegaPlot(mimeType);
271 const divStyle: React.CSSProperties = {
272 backgroundColor: vegaPlot ? 'white' : undefined
273 };
274 if (vegaPlot) {
275 // Vega library expects data to be passed as serialized JSON instead of a native
276 // JS object.
277 data = typeof data === 'string' ? data : JSON.stringify(data);
278 }
279 return (
280 <div style={divStyle}>
281 <Transform data={data} onError={console.error} />
282 </div>
283 );
284 }
285}
286
287function isVegaPlot(mimeType: string) {

Callers 1

renderMethod · 0.95

Calls 2

getTransformFunction · 0.90
isVegaPlotFunction · 0.85

Tested by

no test coverage detected