Template:Code/doc: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
mNo edit summary
(documented {{highlight}})
Line 29: Line 29:
| {{CodeBlock|{{Code|{{Tint|color=yellow|style}}={{Tint|color=green|color:#EF9B9B}}|{{Tint|color=comment|Hello, World!}}}}}}
| {{CodeBlock|{{Code|{{Tint|color=yellow|style}}={{Tint|color=green|color:#EF9B9B}}|{{Tint|color=comment|Hello, World!}}}}}}
| {{Capsule|margin=4px|{{Code|style=color:#EF9B9B|Hello, World!}}}}
| {{Capsule|margin=4px|{{Code|style=color:#EF9B9B|Hello, World!}}}}
|-
| align=center | {{Code|{{Param|highlight}}}}
| Adds syntax highlighting for the language specified by {{param|lang}}. {{Bug|Condenses code into one line.}}
| {{CodeBlock|margin=5px|<nowiki>{{Code|lang=c|highlight=1|int main() {return 0;} }}</nowiki>}}
| {{Capsule|margin=5px|{{Code|lang=c|highlight=1|int main() {return 0;} }}}}
|-
|}
|}



Revision as of 11:10, 14 August 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

Parameters Description Examples Preview
{{{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.
{{Code|Hello, World!}}
{{Code|preset=0|Hello, World!}}
{{Code|preset=1|Hello, World!}}
{{Code|preset=2|Hello, World!}}
{{Code|preset=3|Hello, World!}}
Hello, World!
Hello, World!
Hello, World!
Hello, World!
Hello, World!
{{{select}}} Text selection mode. Uses the user-select CSS property. Default value is unset.
{{Code|select=none|Hello, World!}}
{{Code|select=all|Hello, World!}}
Hello, World!
Hello, World!
{{{style}}} CSS styles.
{{Code|style=color:#EF9B9B|Hello, World!}}
Hello, World!
{{{highlight}}} Adds syntax highlighting for the language specified by {{{lang}}}.
Icon-Bug.pngBug:Condenses code into one line.  [todo tested in ?]
{{Code|lang=c|highlight=1|int main() {return 0;} }}
int main() {return 0;}