QuantEcon / sphinxcontrib-jupyter

A Sphinx Extension for Generating Jupyter Notebooks
BSD 3-Clause "New" or "Revised" License
77 stars 23 forks source link

TEST: Add rst2ipynb test for images rst and expected output #38

Closed mmcky closed 6 years ago

mmcky commented 6 years ago

This adds the images.rst test from the rst2ipynb project.

This is failing because of the LaTeX preamble that is in the expected output of the rst2ipynb project. I propose to remove this preamble from the reference output notebook ipynb\images.rst.

Result:

Testing _build/jupyter/images.ipynb ...
[FAIL] _build/jupyter/images.ipynb and ipynb/images.ipynb are different:
[{'op': 'patch', 'key': 'cells', 'diff': [{'op': 'addrange', 'key': 0, 'valuelist': [{'cell_type': 'markdown', 'metadata': {}, 'source': '$$\n\\def\\CC{\\bf C}\n\\def\\QQ{\\bf Q}\n\\def\\RR{\\bf R}\n\\def\\ZZ{\\bf Z}\n\\def\\NN{\\bf N}\n$$\n# Images\n\n<img src="hood.jpg" alt="image" style="width:60.0%" />'}]}, {'op': 'removerange', 'key': 0, 'length': 1}]}]
mmcky commented 6 years ago

this extension includes images as markdown rather than through html

![_static/hood.jpg](_static/hood.jpg)

rather than

<img src="hood.jpg" alt="image" style="width:60.0%" />

In my view this is the right choice. But may need to think about ability to scale: https://stackoverflow.com/questions/14675913/changing-image-size-in-markdown

mmcky commented 6 years ago

So looking at the GFP spec it appears there is no way to support image scale in markdown directly. I suppose in this case we will need to write html image inclusions with support for width components of the rst directives.

mmcky commented 6 years ago

Closing -- as have migrated the updated test set to #45.