MCPcopy
hub / github.com/deepnote/deepnote / renderDataOutput

Function renderDataOutput

packages/cli/src/output-renderer.ts:44–71  ·  view source on GitHub ↗
(dataOutput: IDisplayData | IExecuteResult)

Source from the content-addressed store, hash-verified

42}
43
44function renderDataOutput(dataOutput: IDisplayData | IExecuteResult): void {
45 const data = dataOutput.data
46 const c = getChalk()
47
48 // Prefer text/plain for terminal rendering
49 if (data['text/plain']) {
50 const text = Array.isArray(data['text/plain']) ? data['text/plain'].join('') : (data['text/plain'] as string)
51 output(text)
52 return
53 }
54
55 // Indicate non-renderable outputs
56 if (data['text/html']) {
57 output(c.dim('[HTML output - not rendered in terminal]'))
58 return
59 }
60
61 if (data['image/png'] || data['image/jpeg'] || data['image/svg+xml']) {
62 output(c.dim('[Image output - not rendered in terminal]'))
63 return
64 }
65
66 // Fallback: show available MIME types
67 const mimeTypes = Object.keys(data)
68 if (mimeTypes.length > 0) {
69 output(c.dim(`[Output with MIME types: ${mimeTypes.join(', ')}]`))
70 }
71}
72
73function renderErrorOutput(errorOutput: IError): void {
74 const c = getChalk()

Callers 1

renderOutputFunction · 0.85

Calls 2

getChalkFunction · 0.90
outputFunction · 0.90

Tested by

no test coverage detected