diff --git a/include/class.format.php b/include/class.format.php
index 5be966780ae0ad122807fd2796f1b457bf636b44..7b80dc97bff94aba13eda8ccb6eb590b94afad2d 100644
--- a/include/class.format.php
+++ b/include/class.format.php
@@ -142,10 +142,12 @@ class Format {
                 'safe' => 1, //Exclude applet, embed, iframe, object and script tags.
                 'balance' => 1, //balance and close unclosed tags.
                 'comment' => 1, //Remove html comments (OUTLOOK LOVE THEM)
-                'tidy' => -1, // Clean extra whitspace
                 'schemes' => 'href: aim, feed, file, ftp, gopher, http, https, irc, mailto, news, nntp, sftp, ssh, telnet; *:file, http, https; src: cid, http, https, data'
                 );
 
+        if (!preg_match('/style="[^"]*white-space:\s*pre/i', $html) !== false)
+            $config['tidy'] = -1; // Clean extra whitspace
+
         return Format::html($html, $config);
     }