mmikkel / Retcon-Craft

A collection of powerful Twig filters for modifying HTML
MIT License
79 stars 9 forks source link

Retcon attr on a p element removes inline element children (anchor links). #59

Closed turnstylerj closed 1 year ago

turnstylerj commented 1 year ago

When using Retcon attr on a paragraph element coming from the CMS as such:

<p>This is a paragraph <a href="#">with a link</a>.</p>
{{ field|retcon([
    ['attr', 'p', { class: 'test' } ],
]) }}

The resulting HTML output strips the inline link element, resulting in:

<p class="test">This is a paragraph with a link.</p>

Am I just using Retcon incorrectly? Feels like I'm missing something looking through the documentation.

mmikkel commented 1 year ago

I'm not able to reproduce this. What kind of field is field? Which Retcon and Craft CMS versions are you running?

turnstylerj commented 1 year ago

Gah, sorry. Got this narrowed down and it wasn't actually a Retcon issue. Appreciate you testing!

mmikkel commented 1 year ago

Glad you got it sorted out, and thanks for the follow-up @turnstylerj!