Template:Code:Formatted/doc

This is a template for writing code examples. You can specify the language the code is in, introductory text, code, output, and explanatory text. The code is syntax highlighted using the SyntaxHighlight extension, and the output is formatted with  tags, meaning that it uses a monospace font and whitespace is preserved.

Parameters

 * - the language code. See the SyntaxHighlight extension page for a list of supported languages. The default language is Lua.
 * - the introductory text. This comes before the code and the output.
 * - the code.
 * - the output.
 * - the explanatory text. This comes after the code and the output.
 * - the hexadecimal color code for the border color, e.g. . Do not include a # symbol, as this is added by default.
 * - the hexadecimal color code for the background color, e.g. . Do not include a # symbol, as this is added by default.
 * - the hexadecimal color code for the output text color, e.g. . Do not include a # symbol, as this is added by default.
 * - an optional width, e.g. "500px".

All parameters are optional.

Note: using a pipe character  in any of the parameters will break the template. This is because for the MediaWiki software, the pipe character signifies the start of a new parameter. To work around this problem you can use the code.