2

When I use the hacksaw to truncate the formatting goes away. If I remove hacksaw it comes back. So, my question has changed, is there a way for me to truncate the text while keeping the formatting?

The return on the line below is from a rich text field and it will not show formatting unless I remove hacksaw.

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

1 Answer 1

4

Hacksaw has an allow parameter where you specify which HTML tags you want it to pass through.

You might want to try something like:

{{ workItem.summary | hacksaw(words='75', append='...', allow='<strong><em><br><p>') }}

That allows p, br, strong, and em tags to pass through untouched. If you need to allow others, just add 'em to the list.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.