Template:Code
Template page
More actions
Wraps a short snippet in inline monospace styling. Used for file names, extensions, values, and other literal text — e.g. .png or preview.jpg.
Usage
{{Code|your text here}}
The first unnamed parameter is the text to format. You can also name it explicitly:
{{Code|code=your text here}}
Snippets containing "="
A snippet that contains an equals sign is mistaken for a named parameter. Number the parameter to fix this:
{{Code|1=width=100}}
Examples
| Markup | Result |
|---|---|
{{Code|.png}} |
.png
|
{{Code|preview.jpg}} |
preview.jpg
|
{{Code|1=width=100}} |
width=100
|
Notes
This template uses only the built-in <code> HTML element, so it works on a stock MediaWiki install with no extra extensions. For multi-line or syntax-highlighted blocks, use the <syntaxhighlight> tag (requires the SyntaxHighlight extension) instead.