danijar / handout

Turn Python scripts into handouts with Markdown and figures
Apache License 2.0
2.02k stars 106 forks source link

image misplaced to end of file #46

Closed epogrebnyak closed 4 years ago

epogrebnyak commented 4 years ago

I got to use handout for a simple jupyter-like visualisation and was adding an image in the middle of the file.

The image does show up, but at the end of file. This is not an intended behaviour, right?

What can be causing it? I initially thought Spyder/ipython session could be the problem, but a standalone intepreter run does the same.

Here is my output: https://epogrebnyak.github.io/sna-ru/handout/index.html

Here is the code: https://github.com/epogrebnyak/sna-ru/issues/1

danijar commented 4 years ago

Are you calling doc.show() after adding the image?

epogrebnyak commented 4 years ago

Indeed! Now I rememeber doc.show() pushes a queue of object sto html.

Maybe add a docstring to https://github.com/danijar/handout/blob/b4d9ee5f31a68153cc35182d1c2f3fc9b04940dc/handout/handout.py#L97

For example:

"""Insert added items at this point in script and save to <outdir>/index.html"""