Visual inline diff view strips out HTML5 elements

Created on 5 August 2021, over 3 years ago
Updated 22 March 2023, about 2 years ago

Problem/Motivation

Comparing revisions using the visual inline diff layout, strips out HTML5 (such as <section> <article> ....etc). These elements are replaced by <div> and <span> tags and as a result the page loses styles.

Proposed resolution

The HTMLPurifier itself is stripping out these elements. Perhaps the diff module could add a feature to allow for HTML5 Definitions for the HTML Purifier. These definitions are available: https://github.com/xemlock/htmlpurifier-html5

For the patch to work or to test, you will need to install https://github.com/xemlock/htmlpurifier-html5
composer require xemlock/htmlpurifier-html5

Feature request
Status

Needs review

Version

1.0

Component

Diff builder plugins

Created by

🇬🇧United Kingdom adstokoe

Live updates comments and jobs are added and updated live.
  • html5

    Implements and supports the use of HTML5.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇺🇸United States luke.leber Pennsylvania

    To work around this and other issues, I've spun up https://drupal.org/project/diff_plus with a resolution for HTML5 elements as well as some other opinionated additions if any issue watchers would like to give it a try.

  • 🇨🇦Canada adriancid Montreal, Canada

    reroll

  • Status changed to Needs work 7 months ago
  • 🇦🇺Australia acbramley

    This needs to go into an MR with tests.

  • 🇮🇳India sandipta

    Along with the above mentioned things, couple of things are still getting removed
    To name a few :
    1. Style Attribute
    2. ID's associated with Section
    3.
    4. Attributes like aria-label, data-title, data-lity, data-toggle, aria-expanded
    5.  
    6.

    7. Custom Data Attributes
  • 🇪🇸Spain tunic Madrid

    I've tried patch from #23 and but see no improvement, the content is displayed totally broken (CSS issues). Not sure if this is because the use of layout builder, paragraphs or what. Using Drupal 10.4.4.

Production build 0.71.5 2024