Automatic line breaking for long text

How to auto-wrap long text in a specified length in Anqi CMS template?

wordwrapThe filter can automatically wrap long text to a specified length.wordwrapWords are separated by spaces. If there is no space, it is considered as a single word. Therefore, if it is continuous Chinese characters, it will not be wrapped.

Usage Instructions

wordwrapHow to use the filter:

{{ obj|wordwrap:number }}

Here is an example demonstration

{{ ""|wordwrap:2 }}
{% filter wordwrap:5 %}{% lorem 26 w %}{% endfilter %}

Display results


Lorem ipsum dolor sit amet,
consectetur adipisici elit, sed eiusmod
tempor incidunt ut labore et
dolore magna aliqua. Ut enim
ad minim veniam, quis nostrud
exercitation