This repository has been archived by the owner on Oct 18, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Change
M. Mikkel Rummelhoff edited this page Aug 19, 2016
·
4 revisions
Convert/change tag types/names (e.g. <p>
to <span>
), or remove tag(s) completely, retaining content (like an inverse striptags
!).
Convert all <p>
tags to <span>
{{ entry.body | retconChange( 'p', 'span' ) }}
Convert all <div>
and <span>
tags to <p>
{{ entry.body | retconChange( [ 'div', 'span' ], 'p' ) }}
Change all elements with the classname ".foo" to <div>
{{ entry.body | retconChange( '.foo', 'div' ) }}
Remove all <em>
tags, retaining their content
{{ entry.body | retconChange( 'em', false ) }}
Remove all <em>
and <strong>
tags, retaining their content
{{ entry.body | retconChange( ['em', 'strong'], false ) }}
Remove the tag for all elements with a classname .foo
, retaining their content
{{ entry.body | retconChange( '.foo', false ) }}
@selectors Mixed
String value or Array of string values
Examples: "p"
".foo"
"#bar"
"div.baz"
@toTag Mixed
String value for the tag type you want to convert to, or false
(or null
) to remove tag
Examples: "p"
"div"
"span"
, false
, null