View Single Post
Old 04-13-2026, 03:43 PM   #7
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 9,676
Karma: 6774048
Join Date: Nov 2009
Device: many
Okay, for those following along, I have attached PrettyPrinter_v030.zip to this post. I still have not solved the issue of how to make the prettyprinter.qcss file easily discoverable and editable (yet).

But I have added code to make best efforts to detect use of white-space and white-space-collapse properties anywhere in the xhtml's style tags, or in its style attributes, and of course anyplace is its linked stylesheets.

If any of these properties are detected condenseText() is never called to prevent PrettyPrinting from doing actual damage.

So it should be safe to use the PrettyPrinter plugin as it is to use Prettify in Sigil master (Sigil master uses the same tests).

I am sure that someway, somehow someone could import another css file (not linked to the xhtml) into a css file that is directly linked to the xhtml and hide a white-space or white-space-collapse property there but ... all the more reason to make a checkpoint *BEFORE* running any Prettify/PrettyPrinter.

The only alternative is to walk all of the epubs css files no matter is they are linked to this xhtml for not, or parse each linked css file fully looking for an @import someplace and process it as well recursively if needed!
Attached Files
File Type: zip PrettyPrinter_v030.zip (14.8 KB, 27 views)

Last edited by KevinH; 04-13-2026 at 03:46 PM.
KevinH is offline   Reply With Quote