ivovalchev/twig-truncate-html

A Twig truncate_html filter without breaking HTML tags.

Installs: 8 129

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 2

Forks: 0

Open Issues: 2

Type:twig-extension

1.0.0 2020-05-05 08:19 UTC

This package is auto-updated.

Last update: 2024-12-09 21:31:22 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) }}