Skip to content

Commit

Permalink
Get size metadata from cell outputs
Browse files Browse the repository at this point in the history
Fixes #226.
  • Loading branch information
mgeier committed Oct 31, 2018
1 parent d941cae commit 274e68b
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/nbsphinx.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,16 @@
{%- elif datatype in ['image/svg+xml', 'image/png', 'image/jpeg', 'application/pdf'] %}
.. image:: {{ output.metadata.filenames[datatype] | posix_path }}
{%- if datatype in output.metadata %}
{%- set width = output.metadata[datatype].width %}
{%- if width %}
:width: {{ width }}
{%- endif %}
{%- set height = output.metadata[datatype].height %}
{%- if height %}
:height: {{ height }}
{% endif %}
{% endif %}
{%- elif datatype in ['text/markdown'] %}
{{ output.data['text/markdown'] | markdown2rst | indent }}
Expand Down

0 comments on commit 274e68b

Please sign in to comment.