{%- set diff_line_attrs= { ' ': '', '+': 'style="background-color: lightgreen;"', '-': 'style="background-color: palevioletred; text-decoration: line-through;"' } %} {%- macro m_difflines(diff, line_attrs=diff_line_attrs) %} {%- for line in diff -%} {{ line[1:] }} {%- endfor %} {%- endmacro %}