Jupyter Notebook Cell Embedding

Embed output from an external Jupyter Notebook in a Quarto document

Quarto 1.3 adds support for embedding cells from a Jupyter Notebook into a Quarto document via an embed shortcode. In HTML documents, links are automatically added that point to a rendered version of the external notebook.

Quarto 1.3

Charlotte Wickham


March 17, 2023

Quarto 1.3 Feature

This post is part of a series highlighting new features in the 1.3 release of Quarto. Get the latest release at https://quarto.org/docs/download.

Starting in Quarto 1.3, you can include the output of an external Jupyter notebook in a Quarto document with the embed shortcode. To embed a notebook cell, provide the path to a Jupyter Notebook and a cell identifier. For example, this notebook called penguins.ipynb has a cell labelled fig-bill-scatter:

A screenshot of a Jupyter Notebook with the name 'penguins.ipynb', with a cell highlighted that has the code chunk option label set to fig-bill-scatter. Below the cell is a plot that has been output.

You can use the following shortcode to embed the output of this cell:

{{< embed penguins.ipynb#fig-bill-scatter >}}

This will embed the plot as follows:

Figure 1: A scatterplot of bill dimensions for penguins, made with Altair.
Source: Palmer Penguins

A link to the source notebook is automatically provided beneath the plot. Following the link takes users to a rendered version of the notebook, allowing them to explore the notebook without having to download and run it locally. For example, clicking on the link to penguins.ipynb gets you to a page that looks like the following:

A screenshot of webpage with the title 'penguins.ipynb', a large blue button labelled 'Download Notebook', followed by the notebook contents.

Beyond this basic usage, head to the Jupyter Cell Embedding highlight docs to learn how to:


Enjoy this blog? Get notified of new posts by email: