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;" or data-foo) to any selector (e.g. p, img, span.foobar etc)
  • Remove attributes for any given selector (e.g. remove style attribute for all p 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


Package Name

To install this plugin, search for its package name on the Plugin Store and click “Install”.


  • Version 2.3.0
  • Last Update 10/22/2021
  • Active Installs 3,413
  • Compatibility Craft 3
  • License MIT
  • Categories Templating

Report an issue