Version 2.1.1

February 24, 2023


  • Fixed bug where calls to DomElement::appendChild(childNode) while iterating over DomElement::childNodes would mutate the node list being iterated. This could sometimes cause the remaining dom elements in the original child node list to be skipped. This had the potential to resulting in lost content. We now call cloneNode() on the childNode reference, inside the loop, prior to processing it.

Version 2.1.0

September 22, 2022


  • Updated plugin meta data for Craft 4.0 support / requirements.
  • Now requires Craft 4.0+ and PHP 8.0.2+

Version 2.0.4

April 27, 2022


  • Fixed a bug where redactor (and possibly other field types) were passing in an object as the $content rather than the expected text/html string. The code now will attempt to cast any non-string $content passed in to a string. As long as the field object has a good __toString() implementation then it works correctly. Unexpected results may occur if you use this with a field type that does not provide the desired output when cast to a string. Note that redactor field type does work correcly with this implementation now.

Version 2.0.3

April 13, 2022


  • Fixed a bug where a <body> tag was wrapping the output when processing HTML strings.

Version 2.0.2

January 30, 2022


  • Fixed internal method naming of the addInline() and rmInline() methods as they are routed as addElement() and remElement() in the twig function declarations. This bug would have prevented a user from using the remarryAddELement() and remarryRemElement() twig functions as described in the documentation. This fixes that issue.

Version 2.0.1

January 4, 2022


  • Fixed a bug where applying filter to an empty field would cause a template error to be thrown. Removed string parameter requirement and added code to ensure the $content parameter is a string by setting it to an empty string if is not a string.

Version 2.0.0

December 1, 2021


  • Complete rework of the plugin.
    • Filter parameter for numWords now also accepts a settings object.
    • Works with basic text and html documents.
    • Works with complex HTML and fully traverses the dom try applying widow protections not just to individual text nodes, but intelligently builds collections of text nodes and inline elements to smartly add non-breaking spaces everywhere you want them and nowhere that you don't.
    • See README for full feature list and documentation.
  • Updated plugin icon.

Version 1.0.0

December 4, 2017


  • Initial release