Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attached images are not readable by sphinx build #492

Open
kolibril13 opened this issue Apr 13, 2023 · 0 comments
Open

Attached images are not readable by sphinx build #492

kolibril13 opened this issue Apr 13, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@kolibril13
Copy link
Contributor

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

  1. Copy an arbitrary image to the clipboard
  2. Paste that image into a selected Jupyter markdown cell
  3. run sphinx-build
  4. 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": [
    "![image.png](attachment:image.png)"
   ]
  }
 ],
 "metadata": {
  "language_info": {
   "name": "python"
  },
  "orig_nbformat": 4
 },
 "nbformat": 4,
 "nbformat_minor": 2
}

and renders like this in VS Code:
image

image


and renders like this in the sphinx build
image


Extra Note 2

Rendering works with nbsphinx, but doesn't with myst-nb.

List your environment

latest myst_nb pip installation, python 3.11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant