By default QTextHtmlImporter::appendNodeText replaces white-space
characters with a single space and leading white-space is removed. When
white-space is set to pre-wrap in the style of the node, it is preserved
instead.
Given that contents are in a span element, setting white-space to
pre-wrap on span makes the setHtml call do the expected thing.