Wrap each line with a span tag Following situation: 

I have a inline-block title with a background gradient applied. So in order that the background always starts from the left, each line will have to be spanned by a span tag. 

Welcome to&lt;br /&gt; 
our site


should become this: 

&lt;span&gt;Welcome to&lt;/span&gt;&lt;br /&gt; 
&lt;span&gt;our site&lt;/span&gt;


I've started with this: 

{{ block.heroTitle|nl2br }} 


But I'm stuck.
Any help appreciated.
You can split your text 

{% set text = block.heroTitle|nl2br %}
{% set splited = text|split('&lt;br /&gt;')%}
{% for part in splited %}
    &lt;span&gt;{{ part }}&lt;/span&gt;
{% endfor %}


If you need you can use the trim filter as well

&lt;span&gt;{{ part|trim }}&lt;/span&gt;