MyST-NB
MyST-NB copied to clipboard
Attached images are not readable by sphinx build
Describe the bug
There's a feature in Jupyter markdown cells, that one can simply paste an image into a cell, and it will automatically be attached and rendered. Bug: These attached images don't render in MyST-NB documententation.
Reproduce the bug
- Copy an arbitrary image to the clipboard
- Paste that image into a selected Jupyter markdown cell
- run sphinx-build
- The log will now give an image file not readable warning:
updating environment: [new config] 5 added, 0 changed, 0 removed
reading sources... [100%] index
/Users/jan-hendrik/projects/p/docs/3_ct_animation.ipynb:20002: WARNING: image file not readable: attachment:image.png
looking for now-outdated files... none found
pickling environment... done
checking consistency... done
preparing documents... done
writing output... [100%] index
generating indices... genindex done
writing additional pages... search done
copying images... [100%] scanner.png
copying static files... done
copying extra files... done
dumping search index in German (code: de)... done
dumping object inventory... done
build finished with problems, 1 warning.
Extra Note 1
An ipynb notebook file with an attached image looks like this:
{
"cells": [
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"# Hello"
]
},
{
"attachments": {
"image.png": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAALAAAABgC ... and so on... " }
},
"cell_type": "markdown",
"metadata": {},
"source": [
""
]
}
],
"metadata": {
"language_info": {
"name": "python"
},
"orig_nbformat": 4
},
"nbformat": 4,
"nbformat_minor": 2
}
and renders like this in VS Code:

and renders like this in the sphinx build

Extra Note 2
Rendering works with nbsphinx, but doesn't with myst-nb.
List your environment
latest myst_nb pip installation, python 3.11