Allow for more complex filtering.

Created on 20 July 2023, over 1 year ago
Updated 9 August 2023, over 1 year ago

Problem/Motivation

When filtering empty tags this creates an issue with anchor tags. These are basically a tags with no href attribute, and are completely acceptable to be "empty"

Proposed resolution

I am guessing that what would be good it to have something like the limit html tags and then have something like this

<a href> <button> <canvas> <drupal-media> <drupal-entity> <iframe> <object> <script> <svg> <textarea> <td> <th>

Then if the a tag as a href attribute it will be filtered out if there is no body.

✨ Feature request
Status

Active

Version

2.0

Component

Code

Created by

πŸ‡¦πŸ‡ΊAustralia gordon Melbourne

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @gordon
  • πŸ‡ΊπŸ‡ΈUnited States danflanagan8 St. Louis, US

    I ran into this same issue. The quickest workaround is to remove

    <a><code> from the list of tags to strip.
    
    My issue was specifically that I didn't want to strip an empty anchor tag if it had an <code>id

    attribute. I wonder if this is the only case worth supporting or if there are other tags and other attributes worth considering.

  • πŸ‡«πŸ‡·France Dom.

    That is definitely something worth supporting indeed :)
    Anyone up for creating a patch ?

  • πŸ‡ΊπŸ‡ΈUnited States danflanagan8 St. Louis, US

    I'll definitely keep an eye on this and might be able to throw up a patch if I get some free time at work. If someone else does the work on the new feature, I will happily make time to add test coverage.

  • πŸ‡ΊπŸ‡ΈUnited States danflanagan8 St. Louis, US

    I have to correct myself...

    The quickest workaround is to remove from the list of tags to strip.

    D'oh! The module offers a list of tags not to strip. So the current solution would be to add <a> to the list of tags not to strip.

    As for the proposed solution:

Production build 0.71.5 2024