Skip to content

Commit

Permalink
Fix README
Browse files Browse the repository at this point in the history
  • Loading branch information
mmikkel committed Mar 28, 2024
1 parent 35924e8 commit 8f2c39f
Showing 1 changed file with 0 additions and 20 deletions.
20 changes: 0 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,26 +23,6 @@ This plugin requires Craft CMS 5.0+

Retcon uses PHP's native [DOMDocument](http://php.net/manual/en/class.domdocument.php) class to parse and modify HTML. Additionally, [Masterminds' HTML5 library](https://github.com/Masterminds/html5-php) is used for HTML5 support, and Symfony's [DomCrawler](https://symfony.com/doc/3.3/components/dom_crawler.html) and [CssSelector](https://symfony.com/doc/3.3/components/css_selector.html) components are used to enable the powerful jQuery-like selector syntax.

## Changes in Retcon 2.x

Retcon 2.x is almost completely backwards compatible with Retcon 1.x. These are the big changes:

* Symfony's [DomCrawler](https://symfony.com/doc/3.3/components/dom_crawler.html) and [CssSelector](https://symfony.com/doc/3.3/components/css_selector.html) components have been added for _much_ more powerful selector capabilities (almost all CSS selectors work). Retcon is basically jQuery now! **Note: all existing selectors in your code will still work, if you're upgrading from Retcon 1.x.**

* Retcon now has full HTML5 support, courtesy of [Masterminds](https://github.com/Masterminds/html5-php).

* The `autoAlt` method now uses the Asset's native `alt` (Craft 4 only) or `title` attributes for the `alt` attribute, if Retcon is fed HTML with Craft CMS [reference tags](https://docs.craftcms.com/v2/reference-tags.html) (typically, content from a Redactor or CKEditor field).

* The `transform`, `lazy` and `srcset` now takes an optional `$selector` parameter (`'img'` by default)

* The `lazy` method has new default values for its `$className` and `$attributeName` parameters. The new defaults are `'lazyload'` and `'src'` (i.e. `'data-src'`). This change is done to mirror the defaults in the popular [lazysizes](https://github.com/aFarkas/lazysizes) library.

* The new `removeEmpty` method removes empty nodes (i.e., nodes that have no text content). Those pesky clients hitting Enter again and again won't know what hit them.

* The `replace` method has been removed. So sorry, it just didn't belong...

* A new `dimensions` filter has been added, which can add missing `width` and `height` attributes to image nodes (Retcon 2.7+).

## Basic usage

Retcon exposes a series of different [methods](#methods) for modifying HTML. Most methods take a `selector` parameter (i.e. the selector(s) for the elements you want to modify, e.g. `'img'`, `'p'` or `'div.foobar'`), and some take additional parameters for further configuration.
Expand Down

0 comments on commit 8f2c39f

Please sign in to comment.