Template:Code/doc: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
No edit summary
mNo edit summary
Line 6: Line 6:


== Parameters and Examples ==
== Parameters and Examples ==
{| class="standard-table" | style="width:100%"
{| cellpadding="6" rules="all" style="width:100%; border:2px solid #444; background:#222"
|- style="background:#1C1C1C; color:#DDD"
! Parameters
! {{int:Listfiles description}}
! {{int:Preview}}
|-
|-
! style="width:12%" | Parameters
| style="font-family:monospace" | {{P| <Text>}} <br> {{P| 1 | <Text>}}
! {{int:listfiles_description}}
| style="background:#2A2A2A" | The text that will be displayed. Can contain links, templates and raw html, except when the {{Param|lang}} parameter is used.
! style="width:20%" | {{int:preview}}
| {{Code|Hello, World!}}
|-
|-
| style="padding:10px; background:#222; font-family:monospace" | {{P| <Text>}} <br> {{P| 1 | <Text>}}
| style="font-family:monospace" | {{P| lang | <Option>}}
| The text that will be displayed. Can contain links, templates and raw html, except when the {{Param|lang}} parameter is used.
| style="background:#2A2A2A" | Adds syntax highlighting for the language specified using [[mw:Extension:SyntaxHighlight|syntaxhighlight]] tag with [[mw:Extension:SyntaxHighlight#inline|inline]] attribute. <br> [[mw:Extension:SyntaxHighlight#Supported_languages|List of Supported languages]].
| style="background:#262626" | {{Code|Hello, World!}}
| {{Code|lang=c|int main() { return 0; } }}
|-
|-
| style="padding:10px; background:#222; font-family:monospace" | {{P| lang | <Option>}}
| style="font-family:monospace" | {{P| style | <CSS>}}
| Adds syntax highlighting for the language specified using [[mw:Extension:SyntaxHighlight|syntaxhighlight]] tag with [[mw:Extension:SyntaxHighlight#inline|inline]] attribute. <br> [[mw:Extension:SyntaxHighlight#Supported_languages|List of Supported languages]].
| style="background:#2A2A2A" | CSS styles. Note that some styles require {{Code|!important}} to be specified.
| style="background:#262626" | {{Code|lang=c|int main() {return 0;} }}
| {{Code|style=color:#EF9B9B !important|Colored text}}
|-
| style="padding:10px; background:#222; font-family:monospace" | {{P| style | <CSS>}}
| CSS styles. Note that some styles require {{Code|!important}} to be specified.
| style="background:#262626" | {{Code|style=color:#EF9B9B !important|Hello, World!}}
|}
|}



Revision as of 03:32, 17 October 2025

Edit-copy.png
This is a documentation subpage for Template:Code.
Don't forget to purge the contents of the base page upon creating or editing this subpage.

This template will allow you to format text as a one-line code.

Usage

This template is usually written in a single line. To use it, insert {{Code}} into the desired page and specify the parameters to the right of the template name in the following format: {{Code|parameter 1 = value|parameter 2 = value}}.

Parameters and Examples

Parameters Description Preview
| <Text>
| 1 = <Text>
The text that will be displayed. Can contain links, templates and raw html, except when the {{{lang}}} parameter is used. Hello, World!
| lang = <Option> Adds syntax highlighting for the language specified using syntaxhighlight tag with inline attribute.
List of Supported languages.
int main() { return 0; }
| style = <CSS> CSS styles. Note that some styles require !important to be specified. Colored text

See Also