Add images, equations, and other media to notebooks

This article explains how to display images, equations, HTML, and links to other notebooks.

Display images

Azure Databricks supports the display of images in Markdown cells. You can display images stored in a Databricks workspace or a Unity Catalog volume.

Display images stored in the workspace

You can use either absolute paths or relative paths to display images stored in a workspace. To display an image stored in a workspace, use the following syntax:

%md
![my_test_image](/Workspace/absolute/path/to/image.png)

![my_test_image](./relative/path/to/image.png)

Embed image in Markdown cell

Display images stored in Volumes

You can use absolute paths to display images stored in volumes. To display an image stored in volumes, use the following syntax:

%md
![my_test_image](/Volumes/absolute/path/to/image.png)

Drag and drop images

You can drag and drop images from your local file system into Markdown cells. The image is uploaded to the current workspace directory and displayed in the cell.

Drag and drop image into Markdown cell

Display mathematical equations

Notebooks support KaTeX for displaying mathematical formulas and equations. For example,

%md
\\(c = \\pm\\sqrt{a^2 + b^2} \\)

\\(A{_i}{_j}=B{_i}{_j}\\)

$$c = \\pm\\sqrt{a^2 + b^2}$$

\\[A{_i}{_j}=B{_i}{_j}\\]

renders as:

Rendered equation 1

and

%md
\\( f(\beta)= -Y_t^T X_t \beta + \sum log( 1+{e}^{X_t\bullet\beta}) + \frac{1}{2}\delta^t S_t^{-1}\delta\\)

where \\(\delta=(\beta - \mu_{t-1})\\)

renders as:

Rendered equation 2

Include HTML

You can include HTML in a notebook by using the function displayHTML. See HTML, D3, and SVG in notebooks for an example of how to do this.

Note

The displayHTML iframe is served from the domain databricksusercontent.com and the iframe sandbox includes the allow-same-origin attribute. databricksusercontent.com must be accessible from your browser. If it is currently blocked by your corporate network, it must added to an allow list.

You can link to other notebooks or folders in Markdown cells using relative paths. Specify the href attribute of an anchor tag as the relative path, starting with a $ and then follow the same pattern as in Unix file systems:

%md
<a href="$./myNotebook">Link to notebook in same folder as current notebook</a>
<a href="$../myFolder">Link to folder in parent folder of current notebook</a>
<a href="$./myFolder2/myNotebook2">Link to nested notebook</a>