Template:Code/doc: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
| Line 6: | Line 6: | ||
== Parameters and Examples == | == Parameters and Examples == | ||
{| class=standard-table | style="width:100%" | {| class="standard-table" | style="width:100%" | ||
|- | |- | ||
! style="width: | ! style="width:12%" | Parameters | ||
! {{int:listfiles_description}} | ! {{int:listfiles_description}} | ||
! | ! style="width:20%" | {{int:preview}} | ||
|- | |- | ||
| | | style="padding:10px; background:#222; font-family:monospace" | {{P| <Text>}} <br> {{P| 1 | <Text>}} | ||
| The text that will be displayed. Can contain links, templates and raw html, except when the {{Param|lang}} parameter is used. | |||
| style="background:#262626" | {{Code|Hello, World!}} | |||
| | |||
| | |||
|- | |- | ||
| style=" | | style="padding:10px; background:#222; font-family:monospace" | {{P| lang | <Option>}} | ||
| 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|lang=c|int main() {return 0;} }} | |||
| style="background | |||
|- | |- | ||
| 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 10:45, 16 October 2025
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.
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.
|
Hello, World!
|
See Also
- {{CodeBlock}}