Template:Code/doc: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
No edit summary
Line 10: Line 10:
! Parameters
! Parameters
! {{int:listfiles_description}}
! {{int:listfiles_description}}
! {{int:apisandbox-examples}}
! colspan="2" style="width:20%" | {{int:apisandbox-examples}}
! {{int:preview}}
! {{int:preview}}
|-
|-
| rowspan="2" style="text-align:center" | <code>{{param|1}}</code>
| rowspan="2" style="text-align:center" | <code>{{param|1}}</code>
| rowspan="2" | Text.
| rowspan="2" | Text.
| style="background-color:#1f1f1f; font-family:monospace" | <pre style="margin:0">| Hello, World!</pre>
| style="background-color:#1f1f1f; border-right:0; font-family:monospace" | <pre style="margin:0">| Hello, World!</pre>
| rowspan="2" style="background-color:#262626" | {{Code|Hello, World!}}
| style="background-color:#1f1f1f; border-left:0; font-family:monospace; text-align:center; color:#8d8c8b; cursor:help" title="<nowiki>{{code|Hello, World!}}</nowiki>" | (?)
| rowspan="2" style="background-color:#262626" | {{code|Hello, World!}}
|-
|-
| style="background-color:#1f1f1f; font-family:monospace" | <pre style="margin:0">| 1 = Hello, World!</pre>
| style="background-color:#1f1f1f; border-right:0; font-family:monospace" | <pre style="margin:0">| 1 = Hello, World!</pre>
| style="background-color:#1f1f1f; border-left:0; font-family:monospace; text-align:center; color:#8d8c8b; cursor:help" title="<nowiki>{{code|1=Hello, World!}}</nowiki>" | (?)
|-
|-
| rowspan="5" style="text-align:center" | <code>{{Param|preset}}</code>
| rowspan="5" style="text-align:center" | <code>{{Param|preset}}</code>
Line 28: Line 30:
:* {{code|preset=1|3}} – A brighter outlined version.
:* {{code|preset=1|3}} – A brighter outlined version.
|-
|-
| style="background-color:#1f1f1f; font-family:monospace" | <pre style="margin:0">| preset = 0</pre>
| style="background-color:#1f1f1f; border-right:0; font-family:monospace" | <pre style="margin:0">| preset = 0</pre>
| style="background-color:#1f1f1f; border-left:0; font-family:monospace; text-align:center; color:#8d8c8b; cursor:help" title="<nowiki>{{code|preset=0|Hello, World!}}</nowiki>" | (?)
| style="background-color:#262626" | {{code|preset=0|Hello, World!}}
| style="background-color:#262626" | {{code|preset=0|Hello, World!}}
|-
|-
| style="background-color:#1f1f1f; font-family:monospace" | <pre style="margin:0">| preset = 1</pre>
| style="background-color:#1f1f1f; border-right:0; font-family:monospace" | <pre style="margin:0">| preset = 1</pre>
| style="background-color:#1f1f1f; border-left:0; font-family:monospace; text-align:center; color:#8d8c8b; cursor:help" title="<nowiki>{{code|preset=1|Hello, World!}}</nowiki>" | (?)
| style="background-color:#262626" | {{code|preset=1|Hello, World!}}
| style="background-color:#262626" | {{code|preset=1|Hello, World!}}
|-
|-
| style="background-color:#1f1f1f; font-family:monospace" | <pre style="margin:0">| preset = 2</pre>
| style="background-color:#1f1f1f; border-right:0; font-family:monospace" | <pre style="margin:0">| preset = 2</pre>
| style="background-color:#1f1f1f; border-left:0; font-family:monospace; text-align:center; color:#8d8c8b; cursor:help" title="<nowiki>{{code|preset=2|Hello, World!}}</nowiki>" | (?)
| style="background-color:#262626" | {{code|preset=2|Hello, World!}}
| style="background-color:#262626" | {{code|preset=2|Hello, World!}}
|-
|-
| style="background-color:#1f1f1f; font-family:monospace" | <pre style="margin:0">| preset = 3</pre>
| style="background-color:#1f1f1f; border-right:0; font-family:monospace" | <pre style="margin:0">| preset = 3</pre>
| style="background-color:#1f1f1f; border-left:0; font-family:monospace; text-align:center; color:#8d8c8b; cursor:help" title="<nowiki>{{code|preset=3|Hello, World!}}</nowiki>" | (?)
| style="background-color:#262626" | {{code|preset=3|Hello, World!}}
| style="background-color:#262626" | {{code|preset=3|Hello, World!}}
|-
|-
Line 47: Line 53:
Default value is {{code|preset=1|unset}}.
Default value is {{code|preset=1|unset}}.
|-
|-
| style="background-color:#1f1f1f; font-family:monospace" | <pre style="margin:0">| select = none</pre>
| style="background-color:#1f1f1f; border-right:0; font-family:monospace" | <pre style="margin:0">| select = none</pre>
| style="background-color:#1f1f1f; border-left:0; font-family:monospace; text-align:center; color:#8d8c8b; cursor:help" title="<nowiki>{{code|select=none|Hello, World!}}</nowiki>" | (?)
| style="background-color:#262626" | {{code|select=none|Hello, World!}}
| style="background-color:#262626" | {{code|select=none|Hello, World!}}
|-
|-
| style="background-color:#1f1f1f; font-family:monospace" | <pre style="margin:0">| select = all</pre>
| style="background-color:#1f1f1f; border-right:0; font-family:monospace" | <pre style="margin:0">| select = all</pre>
| style="background-color:#1f1f1f; border-left:0; font-family:monospace; text-align:center; color:#8d8c8b; cursor:help" title="<nowiki>{{code|select=all|Hello, World!}}</nowiki>" | (?)
| style="background-color:#262626" | {{code|select=all|Hello, World!}}
| style="background-color:#262626" | {{code|select=all|Hello, World!}}
|-
|-
| style="text-align:center" | <code>{{Param|style}}</code>
| style="text-align:center" | <code>{{Param|style}}</code>
| CSS styles.
| CSS styles.
| style="background-color:#1f1f1f; font-family:monospace" | <pre style="margin:0">| style = color:#EF9B9B</pre>
| style="background-color:#1f1f1f; border-right:0; font-family:monospace" | <pre style="margin:0">| style = color:#EF9B9B</pre>
| style="background-color:#1f1f1f; border-left:0; font-family:monospace; text-align:center; color:#8d8c8b; cursor:help" title="<nowiki>{{code|style=color:#EF9B9B|Hello, World!}}</nowiki>" | (?)
| style="background-color:#262626" | {{code|style=color:#EF9B9B|Hello, World!}}
| style="background-color:#262626" | {{code|style=color:#EF9B9B|Hello, World!}}
|-
|-
| style="text-align:center" | <code>{{Param|highlight}}</code>
| style="text-align:center" | <code>{{Param|highlight}}</code>
| Adds syntax highlighting for the language specified. {{Bug|Condenses code into one line.}}
| Adds syntax highlighting for the language specified. {{Bug|Condenses code into one line.}}
| style="background-color:#1f1f1f; font-family:monospace" | <pre style="margin:0">| highlight = c</pre>
| style="background-color:#1f1f1f; border-right:0; font-family:monospace" | <pre style="margin:0">| highlight = c</pre>
| style="background-color:#1f1f1f; border-left:0; font-family:monospace; text-align:center; color:#8d8c8b; cursor:help" title="<nowiki>{{code|highlight=c|int main() {return 0;}}}</nowiki>" | (?)
| style="background-color:#262626" | {{code|highlight=c|int main() {return 0;} }}
| style="background-color:#262626" | {{code|highlight=c|int main() {return 0;} }}
|-
|-

Revision as of 13:53, 7 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 Examples Preview
{{{1}}} Text.
| Hello, World!
(?) Hello, World!
| 1 = Hello, World!
(?)
{{{preset}}} Preset Template Styles. The following presets are available:
  • Default – The default style is based on Markdown;
  • 0 – Clear version;
  • 1 – Desaturated version;
  • 2 – Outlined version;
  • 3 – A brighter outlined version.
| preset = 0
(?) Hello, World!
| preset = 1
(?) Hello, World!
| preset = 2
(?) Hello, World!
| preset = 3
(?) Hello, World!
{{{select}}} Text selection mode.

Uses the user-select CSS property.

Default value is unset.

| select = none
(?) Hello, World!
| select = all
(?) Hello, World!
{{{style}}} CSS styles.
| style = color:#EF9B9B
(?) Hello, World!
{{{highlight}}} Adds syntax highlighting for the language specified.
Icon-Bug.pngBug:Condenses code into one line.  [todo tested in ?]
| highlight = c
(?) int main() {return 0;}

See Also