diff --git a/nbconvert/templates/html/basic.tpl b/nbconvert/templates/html/basic.tpl index 110e86423..8db34c1ba 100644 --- a/nbconvert/templates/html/basic.tpl +++ b/nbconvert/templates/html/basic.tpl @@ -155,6 +155,10 @@ height={{ height }} {%- if output | get_metadata('unconfined', 'image/png') %} class="unconfined" {%- endif %} +{%- set alttext=(output | get_metadata('alt', 'image/png')) or (cell | get_metadata('alt')) -%} +{%- if alttext is not none %} +alt="{{ alttext }}" +{%- endif %} > {%- endblock data_png %} @@ -177,6 +181,10 @@ height={{ height }} {%- if output | get_metadata('unconfined', 'image/jpeg') %} class="unconfined" {%- endif %} +{%- set alttext=(output | get_metadata('alt', 'image/jpeg')) or (cell | get_metadata('alt')) -%} +{%- if alttext is not none %} +alt="{{ alttext }}" +{%- endif %} > {%- endblock data_jpg %}