<p>I believe filters are applied in the order they're written. So in your example you're probably applying the new line breaks with <code>nl2br</code> and then removing them again with hacksaw.</p>

<p>Try:</p>

<pre><code>&lt;p&gt;{{ workItem.summary | hacksaw(words='75', append='...') | nl2br }}&lt;/p&gt;
</code></pre>

<p>Alternatively you could try setting hacksaw to allow line break tags. Something like this (untested):</p>

<pre><code>&lt;p&gt;{{ workItem.summary | nl2br | hacksaw(words='75', append='...', allow='&lt;br&gt;') }}&lt;/p&gt;
</code></pre>

<p>I'd go with the first option though.</p>

CC BY-SA 3.0
2016-02-15T14:23:57.817Z
Thanks for your time and answer, I realized after continuing to play with this that I do not need to add the function I was trying to add.  My issue is comes from adding "hacksaw" to the text is breaking the formatting, I was trying to solve by adding in the nl2br function but I was just misunderstanding the issue.
Rockwell Rice
CC BY-SA 3.0
2016-02-15T08:01:17.827Z
2016-02-15T08:01:17.827Z
Jamie Pittock
<p>** </p>

<p>After continuing to play around with this I realized that I did not need to add nl2br, adding hacksaw was actually removing the formatting from the rich text field.  I opened a new question <a href="https://craftcms.stackexchange.com/questions/13702/hacksaw-breaking-rich-text-field">here
</a> if anyone can help or has encountered this issue any help would be appreciated.</p>

<p>**</p>

<p>I have a line</p>

<pre><code> &lt;p&gt;{{ workItem.summary | hacksaw(words='75', append='...') }}&lt;/p&gt;
</code></pre>

<p>I need to add </p>

<pre><code> nl2br
</code></pre>

<p>to it.  I have tried</p>

<pre><code> &lt;p&gt;{{ workItem.summary | nl2br | hacksaw(words='75', append='...') }}&lt;/p&gt;
</code></pre>

<p>and</p>

<pre><code> &lt;p&gt;{{ nl2br (workItem.summary hacksaw(words='75', append='...')) }}&lt;/p&gt;
</code></pre>

<p>Neither worked.</p>

<p>Can anyone shed some light on the syntax I need to get this to work correctly?</p>

CC BY-SA 3.0
2016-02-14T23:47:41.687Z
Do you mean [``nl2br``](http://twig.sensiolabs.org/doc/filters/nl2br.html) (new line to line break?) You have ``nb2lr``.
RitterKnight
CC BY-SA 3.0
2016-02-15T00:48:29.203Z
Ya that is what I meant
Rockwell Rice
<templating><filter>
How to apply multiple Twig filters to text - SOLVED
# How to apply multiple Twig filters to text - SOLVED

(Asked by: username_0 on 2016-02-14)

** 
After continuing to play around with this I realized that I did not need to add nl2br, adding hacksaw was actually removing the formatting from the rich text field.  I opened a new question here
 if anyone can help or has encountered this issue any help would be appreciated.
**
I have a line
 {{ workItem.summary | hacksaw(words='75', append='...') }}

I need to add 
 nl2br

to it.  I have tried
 {{ workItem.summary | nl2br | hacksaw(words='75', append='...') }}

and
 {{ nl2br (workItem.summary hacksaw(words='75', append='...')) }}

Neither worked.
Can anyone shed some light on the syntax I need to get this to work correctly?

**Tags:** templating, filter

> **Comments:**
> **username_1**: Do you mean [``nl2br``](http://twig.sensiolabs.org/doc/filters/nl2br.html) (new line to line break?) You have ``nb2lr``.  
> **username_0**: Ya that is what I meant  

---

## 1 answers

### Answer by username_2 on 2016-02-15. Score: 6

I believe filters are applied in the order they're written. So in your example you're probably applying the new line breaks with nl2br and then removing them again with hacksaw.
Try:
{{ workItem.summary | hacksaw(words='75', append='...') | nl2br }}

Alternatively you could try setting hacksaw to allow line break tags. Something like this (untested):
{{ workItem.summary | nl2br | hacksaw(words='75', append='...', allow='') }}

I'd go with the first option though.

> **Comments:**
> **username_0**: Thanks for your time and answer, I realized after continuing to play with this that I do not need to add the function I was trying to add.  My issue is comes from adding "hacksaw" to the text is breaking the formatting, I was trying to solve by adding in the nl2br function but I was just misunderstanding the issue.  

---

