This template can be used in a tip to create nowiki code samples.
Example:
- "
{{code|Bold <b>, italic <i>}}" displays as "Bold <b>, italic <i>"
Instead of using this template, it is best to use <code> tags to display code samples because that always works and is simple for other editors to understand. For example, <code>:echo 'An example'</code> displays as :echo 'An example'.
Our MediaWiki:Common.css causes text in code tags to not wrap: the above example will not have a line break within the text. The same applies to text produced by the {{code}} template.
Text in code tags obeys the normal rules of wikitext, but the code template displays the text as "nowiki". For example:
- "
<code>some ''italic <u>text</u>''</code>" displays as "some italic text" - "
{{code|some ''italic <u>text</u>''}}" displays as "some ''italic <u>text</u>''"
However, text in a template parameter must not use:
=(workaround is to put1=before the parameter:{{code|1=:set ts=12}})|(workaround is to use|instead of|)}}(indicates the end of the template)