Rendering MyST figures in the notebook?
See original GitHub issueHi,
Thanks a lot for creating such a wonderful project like jupyter-book! I have just started using it and it is fantastic!
I just have a quick question about inserting figures (e.g. .png files) in Jupyter notebook and then rendering them in a book.
I need to control the size of a figure, so in the Jupyter notebook, I would write:
<img src="my_image.png" width="700" align="left"/>
but this does not render properly in the book - the following code cell is rendered very small next to the image.
From issue [#562] I can see that HTML is not recommended, and thus we should use MyST, so the command above becomes like this:
```{figure} ./my_image.png
---
height: 200px
align: left
---
```
This command nicely renders the figure in the book, but not in the notebook - I see part of the code. Is that correct?
Is there a way to use one command to render figures both in jupyter book and in jupyter notebook, when I need to control and try out figure characteristics (e.g. size)?
Thanks a lot!
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (5 by maintainers)
Top GitHub Comments
Correct rendendering of HTML images is now possible in MyST 😄 See https://myst-parser.readthedocs.io/en/latest/using/syntax.html#images This will be available in jupyter-book soon!
I got struck by the same problem today. I worked around it by forcing sphinx to copy the image files over so that the
<img src="foo/bar.jpg">
links would work. To achieve this, I created an “assets” directory (any other name would work), reproducing the directory structure and containing links to the relevant pictures. E.g.assets/foo/bar.jpg
is a link tofoo/bar.jpg
.Then I added this:
Really just a workaround …