Whitespace


PmWiki 2.1.12 makes the CSS property called "white-space" available as a WikiStyle.

Depending on browsers and versions of CSS, the following values may be available as "=arguments"

  • white-space=normal (default)
  • white-space=pre
    • Preformatted: like html <pre> element; no line-wrapping; all spaces, carriage returns, and linefeeds are displayed "as-is" from the source.
  • white-space=pre-wrap
    • Same as pre, except line-wrapping is restored; tabs displayed
    • Introduced in CSS 2.1
  • white-space=-moz-pre-wrap
    • Same as pre, except line-wrapping is restored; tabs displayed
  • white-space=-o-pre-wrap
    • Same as pre, except line-wrapping is restored; tabs displayed as glyph
  • white-space=nowrap
    • Multiple carriage returns and multiple spaces collapsed to a single space

Now to test each of these on PmWiki using the following text:

Line 1 is short.
Line 2 has a 	tab and extra   spaces    between     words.
Line 3 is a very long line that continue with text because it is a very long line that continue with text because it is a very long line that continue with text because it is a very long line that continue with text because it is a very long line.

Line 5 is preceded by two carriage returns (there is no text on line 4)


Line 8  is preceded by three carriage returns (there is no text on lines 6 and 7)

>>white-space=normal<<

Line 1 is short. Line 2 has a tab and extra spaces between words. Line 3 is a very long line that continue with text because it is a very long line that continue with text because it is a very long line that continue with text because it is a very long line that continue with text because it is a very long line.

Line 5 is preceded by two carriage returns (there is no text on line 4)

Line 8 is preceded by three carriage returns (there is no text on lines 6 and 7)


>>white-space=pre<<

Line 1 is short. Line 2 has a tab and extra spaces between words. Line 3 is a very long line that continue with text because it is a very long line that continue with text because it is a very long line that continue with text because it is a very long line that continue with text because it is a very long line.

Line 5 is preceded by two carriage returns (there is no text on line 4)

Line 8 is preceded by three carriage returns (there is no text on lines 6 and 7)


>>white-space=pre-wrap<<

Line 1 is short. Line 2 has a tab and extra spaces between words. Line 3 is a very long line that continue with text because it is a very long line that continue with text because it is a very long line that continue with text because it is a very long line that continue with text because it is a very long line.

Line 5 is preceded by two carriage returns (there is no text on line 4)

Line 8 is preceded by three carriage returns (there is no text on lines 6 and 7)


>>white-space=-moz-pre-wrap<<

Line 1 is short. Line 2 has a tab and extra spaces between words. Line 3 is a very long line that continue with text because it is a very long line that continue with text because it is a very long line that continue with text because it is a very long line that continue with text because it is a very long line.

Line 5 is preceded by two carriage returns (there is no text on line 4)

Line 8 is preceded by three carriage returns (there is no text on lines 6 and 7)


>>white-space=-o-pre-wrap<<

Line 1 is short. Line 2 has a tab and extra spaces between words. Line 3 is a very long line that continue with text because it is a very long line that continue with text because it is a very long line that continue with text because it is a very long line that continue with text because it is a very long line.

Line 5 is preceded by two carriage returns (there is no text on line 4)

Line 8 is preceded by three carriage returns (there is no text on lines 6 and 7)


>>white-space=nowrap<<

Line 1 is short. Line 2 has a tab and extra spaces between words. Line 3 is a very long line that continue with text because it is a very long line that continue with text because it is a very long line that continue with text because it is a very long line that continue with text because it is a very long line.

Line 5 is preceded by two carriage returns (there is no text on line 4)

Line 8 is preceded by three carriage returns (there is no text on lines 6 and 7)


Observations on an Apple Mac OS X, using the following browsers:

  • Firefox 1.5.0.6
  • iCab b382
  • Netscape 7.1 (because it is so bad)
  • Omniweb 5.1.2
  • Safari 2.0.4

And on an Windows XP using the following browsers:

  • Firefox 1.5.0.4
  • Internet Explorer 6.0.2800.1106
  • Netscape 7.1

>>white-space=pre<<

  • works on all browsers tested
    • But two and three carriage returns look the same

>>white-space=pre-wrap<<

  • works on iCab

>>white-space=-moz-pre-wrap<<

  • Works on Firefox (Mac & PC) and Netscape (Mac & PC)
 0: 00.00 00.00 config start
 1: 00.00 00.00 config end
 2: 00.03 00.02 MarkupToHTML begin
 3: 00.06 00.05 MarkupToHTML end
 4: 00.06 00.06 MarkupToHTML begin
 5: 00.07 00.06 ReadApprovedUrls SiteAdmin.ApprovedUrls begin
 6: 00.07 00.07 ReadApprovedUrls SiteAdmin.ApprovedUrls end
 7: 00.08 00.07 MarkupToHTML end
 8: 00.08 00.07 MarkupToHTML begin
 9: 00.08 00.08 MarkupToHTML end
10: 00.09 00.08 now
Peak memory: 3,143,200 bytes