In my previous post I described extended “All properties” content compare mode. Now I’d like to show “Compare with markup” view. It allows editor to visually check the differences between two pages. The compare page versions with markup view is similar to previous solution, but instead of comparing data on property level, whole HTML is compared.

compare with markup mode

This functionality was available in EPiServer 6, so I reused most of the code from those libraries. The editor view is an ASPX Webform page with no markup. In the code behind OnLoad event the HTML differences are rendered based on PageReferences passed as query string parameters. Both page versions are rendered to strings and compared. To compare data I used code from EPiServer 6, but htmldiff library should also do the job.

Because blocks do not have URL, you need to prepare utility page used to render block.

Client code

To create new view I reused SideBySideCompareView widget to simplify the code. The HTML differences are displayed in right panel with 100% of width. The left panel width is minimized to 0. To load the content I used builtin EPiServer Iframe widget. It’s very easy to use it – we need only to call load method with URL parameter.

After clicking compare with markup the editor will see content with differences.

compare with markup

Compare with markup preview