Template:Code/doc: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
mNo edit summary |
||
| Line 3: | Line 3: | ||
== Usage == | == Usage == | ||
<div style="margin:-8px 0 8px"><span style="display:inline-block; width:22px; height:16px; background:#FFF; vertical-align:text-bottom; clip-path:path('M0 4v8H1V4ZM9 4v8h1V4ZM3 6v4H7V6Zm9 0v4h4V6Z')"></span>This template prefers inline formatting of parameters</div> | |||
{| cellpadding="6" rules="all" style="width:100%; border:1px solid #555; background:#2D2D2D" | |||
{| cellpadding="6" rules="all" style="width:100%; border: | |- style="background:#333; color:#DFDFDF" | ||
|- style="background:# | |||
! Parameters | ! Parameters | ||
! {{int:Listfiles description}} | ! {{int:Listfiles description}} | ||
! {{int:Preview}} | ! {{int:Preview}} | ||
|- | |- | ||
| style="font-family:monospace" | {{P| <Text>}} <br> {{P| 1 | <Text>}} | | style="background:#333; color:#D8D7D6; 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. | |||
| {{Code|Hello, World!}} | | style="background:#262626" | {{Code|Hello, World!}} | ||
|- | |- | ||
| style="font-family:monospace" | {{P| lang | <Option>}} | | style="background:#333; color:#D8D7D6; 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]]. | |||
| {{Code|lang=c|int main() { return 0; } }} | | style="background:#262626" | {{Code|lang=c|int main() { return 0; } }} | ||
|- | |- | ||
| style="font-family:monospace" | {{P| style | <CSS>}} | | style="background:#333; color:#D8D7D6; font-family:monospace" | {{P| style | <CSS>}} | ||
| CSS styles. Note that some styles require {{Code|!important}} to be specified. | |||
| {{Code|style=color:#EF9B9B !important|Colored text}} | | style="background:#262626" | {{Code|style=color:#EF9B9B !important|Colored text}} | ||
|} | |} | ||
Revision as of 14:15, 18 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 prefers inline formatting of parameters
| 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
- {{CodeBlock}}