ivovalchev/twig-truncate-html

A Twig truncate_html filter without breaking HTML tags.

Installs: 6 705

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 2

Forks: 0

Open Issues: 1

Type:twig-extension

1.0.0 2020-05-05 08:19 UTC

This package is auto-updated.

Last update: 2024-03-29 03:50:37 UTC


README

composer require ivovalchev/twig-truncate-html

And add it to your services.yaml:

    app.twig_extension:
        class: IvoValchev\TruncateHtmlExtension\TruncateHtmlExtension
        tags:
            - { name: twig.extension }

How to use

{{ "<p>hello world</p>"|truncate_html(5) }}