Template:Ns/doc

Template:ns is designed to insert between 0 and 83 non-breaking (non-linewrapping) spaces rapidly according to the number assigned as its first (unnamed) parameter. If this parameter is not supplied or its value is not numeric, it inserts a default three non-breaking spaces.

Usage and examples
The effect of the count, such as in "{&#123;ns|30}}" is identical to putting 30 copies of "&amp;#160;" into the text.

In translation of text to uppercase letters, the spacing is retained. Compare:
 * BEGIN  END &rarr; BEGIN   END
 * BEGIN  END &rarr; BEGIN   END

For gaps wider than 83 spaces, then multiple instances can be used, such as "       " to insert 90 non-breaking spaces.

Performance considerations
Template:ns has been designed to rapidly insert a few, or numerous, non-breaking spaces where wrapping is not wanted, such as to pad table headings or align some entries in columns. It has been clocked to run faster than 1,530x times per second (in December 2012). The number of spaces, from 0 to 83, does not affect the speed of formatting. It invokes the parser function "padleft:" to repeat "&amp;#160;" several, or dozens, of times. Also, the expansion depth has been kept limited, as only 5 levels deep, to allow use anywhere, to generate spaces in any complex templates or tables.

Beyond the maximum count of 83 spaces, the template truncates at 500-characters long (limited by padleft), with "&amp;#" at the end. The default count, as 3 spaces, was chosen because a 1-or-2-space gap is often coded as simply " &amp;nbsp;" and hence, 3 spaces is the first gap needing longer markup. The short template name, "ns" avoids transposing letters as "nsbp" for dyslexic users.

For gaps wider than 83 spaces, then multiple instances of {ns} can be used, such as "       " to insert 90 non-breaking spaces.