Automatic line break for long text

How to make long text automatically wrap to a specified length in the Anqi CMS template?

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

Usage method

wordwrapHow to use the filter:

{{ obj|wordwrap:number }}

Example Demonstration

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

Display result


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