php-htmldiff icon indicating copy to clipboard operation
php-htmldiff copied to clipboard

Individual Element Styling is Removed

Open mprythero opened this issue 3 years ago • 1 comments

I have an individual problem with the HTMLDiff and it removing styling of lists.

Say I have the following text to compare:

<ol style="list-style-type:upper-latin;">
<li>No public officer or employee having the power or duty to perform an official act related to a contract or transaction which is the subject of an official act or action of the Town shall:
<ol>
<li>Have or thereafter acquire an interest in such contract or transaction unless said contract or transaction resulted from the proper bid process for the Town;&nbsp;</li>
</ol>
</li>
</ol>

Everytime it compares the above text, it strips the style of the ol, rending the lists basically useless. Is there a way I could keep the styling? I need it to maintain the lists in our manuals but I would like to maintain the lists as they are originally, not with the list style stripped out.

Thanks!

mprythero avatar Jun 21 '21 01:06 mprythero

Hi, this is likely done by purifier, you can disable purifier by doing ->setPurifierEnabled(false) on the htmldiff config.

However I do suggest you purify the html that you diff for the best most accurate results (by using htmlpurifier yourself, and altering the config to specify what attributes you really do not want to get stripped before sending it to the differ). Unless you are sure the HTML is as clean and correct as can be.

SavageTiger avatar Jun 28 '21 08:06 SavageTiger