Skip to content
M. Mikkel Rummelhoff edited this page Mar 5, 2018 · 1 revision

This filter will remove anything but the elements matching the given selector(s).

Usage/examples

Remove everything except img tags

{{ entry.body | retconOnly( 'img' ) }}

Remove everything except img and span tags

{{ entry.body | retconOnly( [ 'img', 'span' ] ) }}

Remove everything except elements with the classname ".foo"

{{ entry.body | retconOnly( '.foo' ) }}

Parameters

@selectors Mixed
String value or Array of string values
Examples: "p" ".foo" "#bar" "div.baz"