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

This filter will wrap matching selectors in whatever element you want.

Usage/examples

Wrap all images in a container with the classname ".imageWrapper"

{{ entry.body | retconWrap( 'img', '.imageWrapper' ) }}

Wrap all span tags in paragraphs

{{ entry.body | retconWrap( 'span', 'p' ) }}

Wrap all img and span tags in paragraphs with the classname ".wrapper"

{{ entry.body | retconWrap( [ 'span', 'img' ], 'p.wrapper' ) }}

Parameters

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

@wrapper String
String value representing the element to create as wrapper
Examples: "p" ".foo" "#bar" "div.baz"