Forum Discussion
Migrating HTML to Modern Pages - Looks great until page is edited, then content is lost
- Aug 02, 2018
The easiest way to understand what's valid HTML is to create a piece of text using all the layout and formatting options you need. Once you've that you can grab the page list item and look at the canvascontent1 field to obtain the generated HTML. You'll see that only a limited number of styles are supported and fixed set of classes for color and size information. Anything else you use can be initially displayed but will be lost during edit.
I'm facing the same issues now utilising PnP.Powershell to import html into text components.
Transformation Framework currently only supports SharePoint Classic > SharePoint Modern pages.
Would be good to know the HTML transformation it performs, is there a reference?
*** Update looks like this is the transformation code
https://github.com/pnp/modernization/blob/master/Tools/SharePoint.Modernization/SharePointPnP.Modernization.Framework/Transform/HtmlTransformator.cs
Images
- <img src=""> = is stripped (after import and Edit+Publish)
HyperLinks
- <a href=""></a> = is stripped (after import and Edit+Publish)
- [[LINK | URL ]] = is transform (after import and Edit+Publish)