Template:Code/doc: Difference between revisions

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


== Parameters and Examples ==
== Parameters and Examples ==
{| class=standard-table | style="width:100%;"
{| class=standard-table | style="width:100%"
|-
|-
! Parameter
! Parameter
Line 11: Line 11:
! Preview
! Preview
|-
|-
| align="center" | {{Code|{{param|style}}}}
| align=center | {{Code|{{param|style}}}}
| The style of the template. The following styles are available:
| The style of the template. The following styles are available:
:* {{Code|1}} - Outlined version. Does not support {{param|bg}} and {{param|color}}.
:* {{Code|style=3|Default}} – the default style is based on Markdown;
:* {{Code|2}} - Desaturated version. Does not support {{param|bg}} and {{param|color}}.
:* {{Code|1}} – Outlined version;
:* {{Code|3}} - Clear version. Does not support {{param|bg}} but supports {{param|color}}.
:* {{Code|2}} Desaturated version;
:* {{Code|4}} - A brighter outlined version. Does not support {{param|bg}} and {{param|color}}.
:* {{Code|3}} Clear version;
:* {{Code|style=3|Default}} - the default style is based on Markdown and supports the {{param|bg}} and {{param|color}} parameters.
:* {{Code|4}} A brighter outlined version.
| {{CodeBlock|&#123;&#123;Code&#124;{{tint|color=yellow|style}}<nowiki>=</nowiki>{{tint|color=green|1}}&#124;{{tint|color=comment|Hello, World!}}&#125;&#125;}} {{CodeBlock|&#123;&#123;Code&#124;{{tint|color=yellow|style}}<nowiki>=</nowiki>{{tint|color=green|2}}&#124;{{tint|color=comment|Hello, World!}}&#125;&#125;}} {{CodeBlock|&#123;&#123;Code&#124;{{tint|color=yellow|style}}<nowiki>=</nowiki>{{tint|color=green|3}}&#124;{{tint|color=comment|Hello, World!}}&#125;&#125;}}{{CodeBlock|&#123;&#123;Code&#124;{{tint|color=yellow|style}}<nowiki>=</nowiki>{{tint|color=green|4}}&#124;{{tint|color=comment|Hello, World!}}&#125;&#125;}}
| {{CodeBlock|&#123;&#123;Code&#124;{{tint|color=yellow|style}}<nowiki>=</nowiki>{{tint|color=green|1}}&#124;{{tint|color=comment|Hello, World!}}&#125;&#125;}} {{CodeBlock|&#123;&#123;Code&#124;{{tint|color=yellow|style}}<nowiki>=</nowiki>{{tint|color=green|2}}&#124;{{tint|color=comment|Hello, World!}}&#125;&#125;}} {{CodeBlock|&#123;&#123;Code&#124;{{tint|color=yellow|style}}<nowiki>=</nowiki>{{tint|color=green|3}}&#124;{{tint|color=comment|Hello, World!}}&#125;&#125;}}{{CodeBlock|&#123;&#123;Code&#124;{{tint|color=yellow|style}}<nowiki>=</nowiki>{{tint|color=green|4}}&#124;{{tint|color=comment|Hello, World!}}&#125;&#125;}}
| {{Capsule|margin=5px|{{Code|style=1|Hello, World!}}}} {{Capsule|margin=5px|{{Code|style=2|Hello, World!}}}} {{Capsule|margin=5px|{{Code|style=3|Hello, World!}}}} {{Capsule|margin=5px|{{Code|style=4|Hello, World!}}}}
| {{Capsule|margin=5px|{{Code|style=1|Hello, World!}}}} {{Capsule|margin=5px|{{Code|style=2|Hello, World!}}}} {{Capsule|margin=5px|{{Code|style=3|Hello, World!}}}} {{Capsule|margin=5px|{{Code|style=4|Hello, World!}}}}
|-
|-
| align="center" | {{Code|{{param|select}}}}
| align=center | {{Code|{{param|select}}}}
| Text selection mode. The following values are available:
| Text selection mode. The following values are available:
:# {{Code|1}} - All (one click selection);
:* {{Code|style=3|Default}} – Initial state;
:# {{Code|2}} - None (template content will not be highlighted).
:* {{Code|0}} None: template content will not be highlighted;
:* {{Code|1}} – All: one click selection.
| {{CodeBlock|&#123;&#123;Code&#124;{{tint|color=yellow|select}}<nowiki>=</nowiki>{{tint|color=green|1}}&#124;{{tint|color=comment|Hello, World!}}&#125;&#125;}} {{CodeBlock|&#123;&#123;Code&#124;{{tint|color=yellow|select}}<nowiki>=</nowiki>{{tint|color=green|2}}&#124;{{tint|color=comment|Hello, World!}}&#125;&#125;}}
| {{CodeBlock|&#123;&#123;Code&#124;{{tint|color=yellow|select}}<nowiki>=</nowiki>{{tint|color=green|1}}&#124;{{tint|color=comment|Hello, World!}}&#125;&#125;}} {{CodeBlock|&#123;&#123;Code&#124;{{tint|color=yellow|select}}<nowiki>=</nowiki>{{tint|color=green|2}}&#124;{{tint|color=comment|Hello, World!}}&#125;&#125;}}
| {{Capsule|margin=5px|{{Code|select=1|Hello, World!}}}} {{Capsule|margin=5px|{{Code|select=2|Hello, World!}}}}
| {{Capsule|margin=5px|{{Code|select=1|Hello, World!}}}} {{Capsule|margin=5px|{{Code|select=2|Hello, World!}}}}
|-
|-
| align="center" | {{Code|{{param|color}}}}
| align=center | {{Code|{{param|color}}}}
| Text color. <br> HSL, HEX, RGB and more are supported.
| Text color. <br> HSL, HEX, RGB and more are supported.
| {{CodeBlock|&#123;&#123;Code&#124;{{tint|color=yellow|color}}<nowiki>=</nowiki>{{tint|color=green|#EF9B9B}}&#124;{{tint|color=comment|Hello, World!}}&#125;&#125;}}
| {{CodeBlock|&#123;&#123;Code&#124;{{tint|color=yellow|color}}<nowiki>=</nowiki>{{tint|color=green|#EF9B9B}}&#124;{{tint|color=comment|Hello, World!}}&#125;&#125;}}
| {{Capsule|margin=5px|{{Code|color=#EF9B9B|Hello, World!}}}}
| {{Capsule|margin=5px|{{Code|color=#EF9B9B|Hello, World!}}}}
|-
|-
| align="center" | {{Code|{{param|bg}}}} <br>&nbsp;<br>{{Code|{{param|background}}}}
| align=center | {{Code|{{param|bg}}}}
| Background color. <br> HSL, HEX, RGB and more are supported. {{Note|If both {{param|background}} and {{param|bg}} are present, {{param|bg}} is preferred.}}
| Background color. <br> HSL, HEX, RGB and more are supported.
| {{CodeBlock|&#123;&#123;Code&#124;{{tint|color=yellow|bg}}<nowiki>=</nowiki>{{tint|color=green|rgba(239,155,155,.15)}}&#124;{{tint|color=comment|Hello, World!}}&#125;&#125;}}
| {{CodeBlock|&#123;&#123;Code&#124;{{tint|color=yellow|bg}}<nowiki>=</nowiki>{{tint|color=green|rgba(239,155,155,.15)}}&#124;{{tint|color=comment|Hello, World!}}&#125;&#125;}}
| {{Capsule|margin=5px|{{Code|bg=rgba(239,155,155,.15)|Hello, World!}}}}
| {{Capsule|margin=5px|{{Code|bg=rgba(239,155,155,.15)|Hello, World!}}}}

Revision as of 04:28, 29 April 2023

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.

Parameters and Examples

Parameter Description Example Preview
{{{style}}} The style of the template. The following styles are available:
  • Default – the default style is based on Markdown;
  • 1 – Outlined version;
  • 2 – Desaturated version;
  • 3 – Clear version;
  • 4 – A brighter outlined version.
{{Code|style=1|Hello, World!}}
{{Code|style=2|Hello, World!}}
{{Code|style=3|Hello, World!}}
{{Code|style=4|Hello, World!}}
Hello, World!
Hello, World!
Hello, World!
Hello, World!
{{{select}}} Text selection mode. The following values are available:
  • Default – Initial state;
  • 0 – None: template content will not be highlighted;
  • 1 – All: one click selection.
{{Code|select=1|Hello, World!}}
{{Code|select=2|Hello, World!}}
Hello, World!
Hello, World!
{{{color}}} Text color.
HSL, HEX, RGB and more are supported.
{{Code|color=#EF9B9B|Hello, World!}}
Hello, World!
{{{bg}}} Background color.
HSL, HEX, RGB and more are supported.
{{Code|bg=rgba(239,155,155,.15)|Hello, World!}}
Hello, World!