From 88dc82292e4d799dd25340f3d754f07bfbb21875 Mon Sep 17 00:00:00 2001 From: Matthias Geier Date: Wed, 31 Oct 2018 17:51:05 +0100 Subject: [PATCH] Get size metadata from cell outputs --- src/nbsphinx.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/nbsphinx.py b/src/nbsphinx.py index c57026a9..714f896f 100644 --- a/src/nbsphinx.py +++ b/src/nbsphinx.py @@ -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 }}