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

Method render

src/renderers/client/render.tsx:37–63  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

35 this.disposables.forEach((d) => d.dispose());
36 }
37 public override render() {
38 const mimeBundle = this.props.output.data as nbformat.IMimeBundle; // NOSONAR
39 // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
40 let data = mimeBundle[this.props.mimeType!];
41
42 // For un-executed output we might get text or svg output as multiline string arrays
43 // we want to concat those so we don't display a bunch of weird commas as we expect
44 // Single strings in our output
45 if (Array.isArray(data)) {
46 data = concatMultilineString(data as nbformat.MultilineString, true);
47 }
48
49 switch (this.props.mimeType) {
50 case 'image/svg+xml':
51 case 'image/png':
52 case 'image/gif':
53 case 'image/jpeg':
54 case 'image/webp':
55 return this.renderImage(
56 this.props.mimeType,
57 data as unknown as Blob | MediaSource,
58 this.props.output.metadata
59 );
60 default:
61 return this.renderOutput(data, this.props.mimeType);
62 }
63 }
64 /**
65 * Custom rendering of image/png and image/jpeg to handle custom Jupyter metadata.
66 * Behavior adopted from Jupyter lab.

Callers 1

renderOutputFunction · 0.45

Calls 3

renderImageMethod · 0.95
renderOutputMethod · 0.95
concatMultilineStringFunction · 0.90

Tested by

no test coverage detected