dzango/twig-truncate-extension
Twig extension that truncates text while preserving HTML tags. Adds a truncate filter with options for length, ending, exact word cutting, and HTML handling—works with rendered markdown or raw content. Easy to register in Twig or Symfony2.
{{ content|markdown|raw|truncate }}) in a single pipeline, reducing the need for custom logic.exact=false) for non-English languages or screen readers.<strong>, <a>) for better rendering._.truncate may suffice).For Executives: "This lightweight Twig extension solves a common UX pain point—cluttered text in templates—by intelligently truncating content while preserving HTML structure. It’s a drop-in solution that reduces frontend bloat, improves load times, and ensures consistent formatting across platforms (e.g., web, APIs). With zero dependents and MIT licensing, it’s a low-risk, high-reward choice to standardize truncation logic, saving dev time and improving content display."
For Engineering:
*"The dzango/twig-truncate-extension provides a battle-tested, configurable Twig filter to truncate text while respecting HTML tags. Key benefits:
markdown|raw|truncate).How can I help you explore Laravel packages today?