Spec-Zone.ru › Deno 2

Jupyter

Create interactive notebooks and execute code cells. Useful for data analysis, visualization, and educational purposes.

Eg Deno.jupyter


function Deno.jupyter.broadcast

unstable
broadcast(
msgType: string,
content: Record<string, unknown>,
extra?: { metadata?: Record<string, unknown>; buffers?: Uint8Array[]; },
): Promise<void>

Broadcast a message on IO pub channel.

await Deno.jupyter.broadcast("display_data", {
  data: { "text/html": "<b>Processing.</b>" },
  metadata: {},
  transient: { display_id: "progress" }
});

await new Promise((resolve) => setTimeout(resolve, 500));

await Deno.jupyter.broadcast("update_display_data", {
  data: { "text/html": "<b>Processing..</b>" },
  metadata: {},
  transient: { display_id: "progress" }
});

Parameters

msgType: string
content: Record<string, unknown>
extra: { metadata?: Record<string, unknown>; buffers?: Uint8Array[]; }
optional

Return Type

Promise<void>

function Deno.jupyter.display

unstable
display(
obj: unknown,
options?: DisplayOptions,
): Promise<void>

Display function for Jupyter Deno Kernel. Mimics the behavior of IPython's display(obj, raw=True) function to allow asynchronous displaying of objects in Jupyter.

Parameters

obj: unknown
  • The object to be displayed
options: DisplayOptions
optional
  • Display options with a default { raw: true }

Return Type

Promise<void>

function Deno.jupyter.format

unstable
format(obj: unknown): Promise<MediaBundle>

Format an object for displaying in Deno

Parameters

obj: unknown
  • The object to be displayed

Return Type

Promise<MediaBundle>

Promise


function Deno.jupyter.html

unstable
html(
strings: TemplateStringsArray,
...values: unknown[],
): Displayable

Show HTML in Jupyter frontends with a tagged template function.

Takes a template string and returns a displayable object for Jupyter frontends.

Examples

const { html } = Deno.jupyter;
html`<h1>Hello, world!</h1>`

Parameters

strings: TemplateStringsArray
...values: unknown[]

Return Type

Displayable

function Deno.jupyter.image

unstable

Overload 1

image(path: string): Displayable

Display a JPG or PNG image.

Deno.jupyter.image("./cat.jpg");
Deno.jupyter.image("./dog.png");

Parameters

path: string

Return Type

Displayable

Overload 2

image(data: Uint8Array): Displayable

Display a JPG or PNG image.

const img = Deno.readFileSync("./cat.jpg");
Deno.jupyter.image(img);

Parameters

data: Uint8Array

Return Type

Displayable

function Deno.jupyter.md

unstable
md(
strings: TemplateStringsArray,
...values: unknown[],
): Displayable

Show Markdown in Jupyter frontends with a tagged template function.

Takes a template string and returns a displayable object for Jupyter frontends.

Examples

const { md } = Deno.jupyter;
md`# Notebooks in TypeScript via Deno ![Deno logo](https://github.com/denoland.png?size=32)

* TypeScript ${Deno.version.typescript}
* V8 ${Deno.version.v8}
* Deno ${Deno.version.deno}

Interactive compute with Jupyter _built into Deno_!
`

Parameters

strings: TemplateStringsArray
...values: unknown[]

Return Type

Displayable

function Deno.jupyter.svg

unstable
svg(
strings: TemplateStringsArray,
...values: unknown[],
): Displayable

SVG Tagged Template Function.

Takes a template string and returns a displayable object for Jupyter frontends.

Example usage:

svg<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"> <circle cx="50" cy="50" r="40" stroke="green" stroke-width="4" fill="yellow" /> </svg>

Parameters

strings: TemplateStringsArray
...values: unknown[]

Return Type

Displayable

interface Deno.jupyter.Displayable

unstable

Properties

[$display]: () => MediaBundle | Promise<MediaBundle>

interface Deno.jupyter.DisplayOptions

unstable

Properties

raw: boolean
optional
update: boolean
optional
display_id: string
optional

interface Deno.jupyter.MediaBundle

unstable

A collection of supported media types and data for Jupyter frontends.

Index Signatures

[key: string]:
string
| object
| undefined

Properties

text/plain: string
optional
text/html: string
optional
image/svg+xml: string
optional
text/markdown: string
optional
application/javascript: string
optional
image/png: string
optional
image/jpeg: string
optional
image/gif: string
optional
application/pdf: string
optional
application/json: object
optional
application/geo+json: object
optional
application/vdom.v1+json: object
optional
application/vnd.plotly.v1+json: object
optional
application/vnd.vega.v5+json: VegaObject
optional
application/vnd.vegalite.v4+json: VegaObject
optional
application/vnd.vegalite.v5+json: VegaObject
optional

interface Deno.jupyter.VegaObject

unstable

Index Signatures

[key: string]: unknown

Properties

$schema: string

namespace Deno.jupyter

unstable

A namespace containing runtime APIs available in Jupyter notebooks.

When accessed outside of Jupyter notebook context an error will be thrown.

Functions

Deno.jupyter.broadcast

Broadcast a message on IO pub channel.

Deno.jupyter.display

Display function for Jupyter Deno Kernel. Mimics the behavior of IPython's display(obj, raw=True) function to allow asynchronous displaying of objects in Jupyter.

Deno.jupyter.format

Format an object for displaying in Deno

Deno.jupyter.html

Show HTML in Jupyter frontends with a tagged template function.

Deno.jupyter.image

Display a JPG or PNG image.

Deno.jupyter.md

Show Markdown in Jupyter frontends with a tagged template function.

Deno.jupyter.svg

SVG Tagged Template Function.

Interfaces

Deno.jupyter.Displayable
No documentation available
  • $display
Deno.jupyter.DisplayOptions
No documentation available
  • display_id
  • raw
  • update
Deno.jupyter.MediaBundle

A collection of supported media types and data for Jupyter frontends.

  • application/geo+json
  • application/javascript
  • application/json
  • application/pdf
  • application/vdom.v1+json
  • application/vnd.plotly.v1+json
  • application/vnd.vega.v5+json
  • application/vnd.vegalite.v4+json
  • application/vnd.vegalite.v5+json
  • image/gif
  • image/jpeg
  • image/png
  • image/svg+xml
  • text/html
  • text/markdown
  • text/plain
Deno.jupyter.VegaObject
No documentation available
  • $schema

Variables

Deno.jupyter.$display
No documentation available

variable Deno.jupyter.$display

unstable

Type

unique symbol

© 2018–2025 the Deno authors
Licensed under the MIT License.
https://docs.deno.com/api/deno/jupyter

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API