Skip to content

Commit

Permalink
Merge pull request #1112 from hx2A/html_alt_text
Browse files Browse the repository at this point in the history
add support for alt tags for jpeg and png images
  • Loading branch information
MSeal authored Oct 9, 2019
2 parents 2a1802e + 4419fee commit fda8ba5
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions nbconvert/templates/html/basic.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}
>
</div>
{%- endblock data_png %}
Expand All @@ -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 %}
>
</div>
{%- endblock data_jpg %}
Expand Down

0 comments on commit fda8ba5

Please sign in to comment.