Skip to content

A Twig truncate_html filter without breaking HTML tags.

License

Notifications You must be signed in to change notification settings

I-Valchev/twig-truncate-html

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Installation

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) }}

About

A Twig truncate_html filter without breaking HTML tags.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages