Help:Advanced editing

This page is intended as a "second step" to users who are familliar with basic editing and wish to learn more complex wikicode.

A common theme amongst these tips is to always preview before saving. All of these features have the potential to do strange, confusing, and sometimes scary things to pages if not perfectly synced.

Fonts and colours
The simplest way of changing the font or the colour of text is the  tag. Here are some simple examples:
 * becomes RED
 * becomes some hex colour
 * becomes It has serifs
 * becomes IMPACT

It is possible to use the  tag instead of   (which works slightly differently), but be warned that it's deprecated in HTML5, which means that you shouldn't be using it even if it works right now because it's planned to be deleted altogether.

Note that changing fonts and text colours should be reserved for signatures and user pages. Articles should be as easy-to-read as possible, which includes no font or colour changes. The main exception is when replication of an official source's visuals is the primary goal, such as the 1226 translation project.

Choice of colours
As with most web markup, there is a list of several "default" colours available in addition to the ability to specify effectively any colour. Examples include:
 * ,,  ,  ,  , etc. Most basic colours can be represented in this way.
 * ,,  , etc. These are known as "hex colours" and can be used to specify any computer-representable colour. In this form, the first two hexadecimal digits represent the amount of red from 0 to 255, while the second pair is green and the third pair is blue.
 * ,,  , etc. This technique uses numbers in decimal instead of in hexadecimal, making it slightly easier to understand at the expense of taking up more space. It also has an optional opacity value (seen in third example of "rgba" instead of "rgb"), where 1.0 is "completely opaque" and 0.0 is "completely transparent", allowing for a wider range of effects.

For more information, see Wikipedia's page on web colours.

Code and nowiki tags
On pages such as this one,  and   tags are used to display code on pages.
 * tags apply styling to the content, so text looks monospaced like it does in the editor.
 * tags tell the parser to not treat anything inside as wikicode; for example, internal links remain in the form of Link.

Inclusion-control tags
Often, it's desirable to separate templates into "content" and "documentation". These two tags provide this.
 * tags specify that the content within will show up on the template's page, but not when the template is used. For example, template documentation and categories should be wrapped in this, as otherwise a template in Category:Templates would place any page it's used on into that category.
 * tags specify that the content within will only show up when the template is used, and not when the template itself is viewed. For example, a template that requires input to function properly may be broken when viewed on its page (potentially causing false problem reports such as broken links); surrounding the template in this will prevent this. Note however that this makes the template impossible to preview, so it must be temporarily removed when editing (and then re-added before saving).

Substitution templates
Certain symbols have multiple usages:
 * The ' symbol is used as both an apostrophe and as bold and italic formatting.
 * The | symbol is used in internal links, but also in tables and parser functions.

There are several cases where the wiki software cannot tell what the intent of a symbol is - for example, attempting to display pieces of a table in a parser function may be seen as part of the parser function itself. To temper these issues, these templates exist:
 * ', which adds '
 * !, which adds |
 * !!, which adds ||

Using these templates will solve most conflation errors.

Tables
Tables are likely the most common advanced form of wikicode and can be tricky to get right even for experienced users.

Table syntax involves a combination of pipes, braces, and exclamation marks:

Tables are best explained by example. This is the code used to create the above table (with code and nowiki tags removed):

When working with tables, spacing is best described as "touchy". Sometimes the amount of spaces between two cells or rows is irrelevant, while other times it breaks the table altogether. Typically this is only an issue when combining tables with templates; most of the time, for text-only tables, spacing is collapsed. As a result, while it's not necessary to provide spacing between code and content, it can help readibility of the page source.

Note the  in the above example. is a combination of CSS styling used for most tables on the wiki for a consistent look. Without it, tables will not have any borders or colour, appearing as text hanging in the middle of nowhere.

For a more comprehensive guide, see MediaWiki's Help:Tables.

Non-breaking space
Sometimes, it is undesireable for a space to ever be broken by a new line. For example, certain tables may have long links or other text string that should never be broken across two lines. The easiest way to fix this is to use the non-breaking space, or. Putting this code in text creates a space that is not considered a legal line break location. In addition, it is treated as a normal space by links, so  will lead to Main Page as expected.

is also a convenient way to specify "blank space" as opposed to "nothing" for tables. There is a difference between "nothing" and "contains a space" for table cells, but adding spaces to a cell will have no effect (they are assumed to exist only for source readability purposes and so are discarded). The non-breaking space is not discared in this way, and can be used to make cells non-empty but still blank.

Parameterized templates
Templates do not have to show the exact same text every time they are used. A common example is the SSBB template, which links to a "Character (SSBB)" page based on the text supplied to it. This is done by adding parameters to templates.

In their simplest form, a parameter is a number or word in triple braces, such as. The code for inputting into a template is. In this case, every time  is written in the template, it will be replaced with.

The parameters,  ,  , etc. are unnamed parameters. For example, in,   is   and   is. These can be combined with named parameters, but unnamed parameters cannot be listed after named ones.

It is possible to specify a default value for parameters, so something sensible appears if they are not specified. For example,  will appear as   if a template usage does not provide. It is common to see, which is a blank default value, and so does not display anything at all if unspecified. Default values always appear on the template page itself and so are a good tool for previewing template edits (for example, set the default value to something you may input in a usage and preview to see how it looks).

Parameter defaults can be "stacked". For example,  will display   if it's given,   if it's not, and   if neither. This can be extended quite a ways, but try to avoid stacks too high, as it becomes difficult to keep track of all the braces.

Parser functions
Some complex template require rudimentary decision-making abilities - for example, only display "SSBM" if a character appears in that game. Parser functions provide this sort of coding. There are several parser functions available, with the more common ones being:


 * Computes a math expression and displays the result.
 * Computes a math expression and displays the result.


 * If "condition" is blank, display "false", otherwise display "true". Common usage includes "display a table row if it has a value, otherwise don't show the row at all" and "use a template if it has a value, otherwise add the page to a maintenance category".
 * If "condition" is blank, display "false", otherwise display "true". Common usage includes "display a table row if it has a value, otherwise don't show the row at all" and "use a template if it has a value, otherwise add the page to a maintenance category".


 * If "one" equals "two", display "true", otherwise display "false". This is a case-sensitive string comparison, so "0.0" does not equal "0", and "Character" does not equal "character".
 * If "one" equals "two", display "true", otherwise display "false". This is a case-sensitive string comparison, so "0.0" does not equal "0", and "Character" does not equal "character".


 * If "math" is true, display "true", otherwise display "false".
 * If "math" is true, display "true", otherwise display "false".


 * Take "something". If it's "1", display "A". If it's "2", display "B". If it's "3", "4", or "5", display "C". Otherwise, display "Q".
 * Take "something". If it's "1", display "A". If it's "2", display "B". If it's "3", "4", or "5", display "C". Otherwise, display "Q".

For a more comprehensive guide, see MediaWiki's Help:Extension:ParserFunctions.

String functions
Strings (text, basically) have various functions available for manipulation purposes. They can become expensive if overused however.


 * Turns all of "Text" into lowercase, resulting in "text". Common if case-insensitive comparison is desired - simply lowercase both sides of the comparison.
 * Turns all of "Text" into lowercase, resulting in "text". Common if case-insensitive comparison is desired - simply lowercase both sides of the comparison.


 * Turns all of "Text" into uppercase, resulting in "TEXT".
 * Turns all of "Text" into uppercase, resulting in "TEXT".


 * Same as lc: and uc:, but only changes the first letter.
 * Same as lc: and uc:, but only changes the first letter.


 * If "number" equals 1, display "1", otherwise display "2". A shortcut for a common piece of logic: determining whether a word should be displayed as plural.
 * If "number" equals 1, display "1", otherwise display "2". A shortcut for a common piece of logic: determining whether a word should be displayed as plural.


 * Displays the length of the given text.
 * Displays the length of the given text.


 * Goes to the "start"th letter and starts looking to the right, displaying position of the first occurrence of "what" in the text. This number is zero-based: 0 indicates the start of the text, 1 is the second letter, etc.
 * Goes to the "start"th letter and starts looking to the right, displaying position of the first occurrence of "what" in the text. This number is zero-based: 0 indicates the start of the text, 1 is the second letter, etc.


 * Displays "length" letters from the text, starting with the "start"th one.
 * Displays "length" letters from the text, starting with the "start"th one.


 * Replaces all "x"s in the text with "q"s.
 * Replaces all "x"s in the text with "q"s.

For a more comprehensive guide, see MediaWiki's Help:Magic words and MediaWiki's Extension:StringFunctions.