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

Static output image size distorts executed output images #608

Closed
aeisenbarth opened this issue Jun 13, 2024 · 1 comment · Fixed by #609
Closed

Static output image size distorts executed output images #608

aeisenbarth opened this issue Jun 13, 2024 · 1 comment · Fixed by #609
Labels
bug Something isn't working

Comments

@aeisenbarth
Copy link
Contributor

Describe the bug

When you have notebooks that are not executed ("execution_mode": "off") and notebooks that are executed, following images can be distorted.

This happens when the executor that was used for the static notebook has saved the size of embedded images:

{
 "data": {
  "image/png": "..."
  "text/plain": [
   "<IPython.core.display.Image object>"
  ]
 },
 "metadata": {
  "image/png": {
   "height": 100,
   "width": 500
  }
 },
 "output_type": "display_data"
}

The image size persists onto all following notebooks or cells that are executed by MyST-NB. This does not happen with jupyter lab or nbsphinx.

Reproduce the bug

  1. Extract the attached docs.zip folder or create a conf.py:

    exclude_patterns = ["_build", "jupyter_execute"]
    extensions = ["myst_nb"]

    and an index.md:

    ```{toctree}
    example <example.ipynb>
    ```

    and the attached notebook file.

  2. Build documentation: sphinx-build -b html docs docs/_build

  3. You might see something like this:

    image

List your environment

(The Github template contains a mistake in the environment command, this project is not jupyter-book, but myst-nb.)

$ pip freeze | grep -E "myst-nb|Sphinx"
myst-nb==1.1.0
Sphinx==7.2.6
@aeisenbarth aeisenbarth added the bug Something isn't working label Jun 13, 2024
@aeisenbarth
Copy link
Contributor Author

Without having looked at the code, I think it could be a static class variable that should be an instance variable.

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

Successfully merging a pull request may close this issue.

1 participant