linebreaksbr Filter

Coding

Documentation

Replaces all newline characters with <br> tags.

Variable

poem = '''Much to his Mum and Dad’s dismay,
Horace ate himself one day.

He didn’t stop to say his grace,
He just sat down and ate his face.

“We can’t have this!” His Dad declared,
“If that lad’s ate, he should be shared.”'''

Template

{{ poem|linebreaks }}

Result

Much to his Mum and Dad’s dismay,<br>Horace ate himself one day.<br><br>He didn’t stop to say his grace,<br>He just sat down and ate his face.<br><br>“We can’t have this!” His Dad declared,<br>“If that lad’s ate, he should be shared.”

Did we get something wrong? Is there a use case for the linebreaksbr filter that we should add? Please let us know.

Send Feedback

Official Documentation
This page last updated on Oct. 30, 2022, 1:21 p.m. EST