Retcon
A collection of powerful Twig filters for modifying HTML. Here are some of the things Retcon can do:
- Add attributes (e.g.
class="foobar"
,style="color:red;"
ordata-foo
) to any selector (e.g.p
,img
,span.foobar
etc) - Remove attributes for any given selector (e.g. remove
style
attribute for allp
tags) - Append to attributes
- Remove DOM nodes by selector (e.g. remove all
span
tags) - Remove everything but given selectors (e.g. remove everything except
img
tags) - Transform inline images (it even uses Imager, if installed)
- Add srcset or lazyloading to inline images
- Inject strings or HTML content
- Change tag names for given selectors (e.g. change all occurrences of
<p>
to<span>
)
...and much more! Check out the Wiki for complete docs and examples.
Update: Retcon is now using Symfony's DomCrawler component for much more powerful selectors. It's basically jQuery now!
This plugin will be free forever
Free
Package Name
To install this plugin, search for its package name on the Plugin Store and click “Install”.