Help:Whitespace

Whitespace, which is any part of text which doesn't contain a visible character such as a space or a line break, generally acts normally as you would expect on Wikia, but there are some situations where whitespace acts counter-intuitively, especially if entered using the classic editor or source mode. Here are just some of those situations, and how to avoid them.

Line Breaks
To get a line break to display on the page, two line breaks (or two presses of the enter/return key on your keyboard) are needed. If you only use one line break, the text after the line break will just continue on next to the text above it as if separated by a normal space character. For example: Hello World turns into:

Hello World

Hello

World turns into:

Hello

World.

However, single line breaks don't follow this pattern when part of a list of either ordered or unordered type. For example, using an unordered list: List ended. Will display as:
 * Item 1
 * Item 2

List ended.
 * Item 1
 * Item 2

This specific problem is often encountered when a single line space is used inside a template for information layout in the source code, causing some templates to force a line break when used inside a list.

Whitespace at the beginning of lines
If a space is added at the beginning of a line or paragraph, all the following text will be placed inside a one line high box. For example: Hello world! Did you know that you can learn more about links at Help:Link? Turns into:

Hello world! Did you know that you can learn more about links at Help:Link? As you can see, this box is similar to the box formed by pre tags, however it does parse wikitext (ie changes things written in MediaWiki code into the thing they're meant to display, instead of leaving it as the code for others to see), unlike the pre tags.

Multiple spaces in a row
If you intend to separate text with multiple spaces, all those spaces will be condensed down to one single space instead of giving the desired spacing. For example: White                                              Space Turns into:

White                                              Space

This can be avoided by using what is known as a non-breaking space which doesn't collapse when a page is displayed to the reader. This is produced by typing &amp;nbsp;. For example: White&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Space Displays as:

White        Space

Note that this is only the case for normal space characters. Line breaks won't collapse on themselves with the exception of when a single line break is used, as documented above.

Indentation
So what do you do if you want to indent your text, since you can't use spaces? Well, use colons! The more colons you put at the beginning of your line of text, the more indented it will be. For example: This is a line of text.
 * This is an indented line of text.
 * This line of text is more indented.

Displays as:

This is a line of text.
 * This is an indented line of text.
 * This line of text is more indented.

Note that if you're indenting the text, the normal line-break collapsing rules don't apply and you can put a line of different indentation directly under another line.