Template:Syntax highlight/doc

From Valve Developer Community
Jump to navigation Jump to search
Edit-copy.png
This is a documentation subpage for Template:Syntax highlight.
Don't forget to purge the contents of the base page upon creating or editing this subpage.

This template has subpages used to apply CSS to text to signify it is a certain category, such as a comment, type, string, etc. the CSS here is taken from how <source> renders code.


Usage

{{Syntax highlight|category|text}}


Currently Supported Categories
Uses Example Shortcuts Preview
Char/String {{Syntax highlight|string|"Hello, World!"}} {{stx|char|'x'}}
{{stx|str|"Hello, World!"}}
Template:Syntax highlight/string
Comment {{Syntax highlight|comment|//comment}} {{stx|cmnt|//comment}} //comment
Control {{Syntax highlight|control|if}} {{stx|ctrl|if}} if
Function {{Syntax highlight|function|main}} {{stx|func|main}} main
Label {{Syntax highlight|label|final}} {{stx|lbl|final}} final
Macro {{Syntax highlight|macro|#define}} {{stx|mac|#define}} #define
Number/Operator {{Syntax highlight|number|3.0f}} {{stx|no|3.0f}}
{{stx|op|+}}
3.0f
Register {{Syntax highlight|register|%rax}} {{stx|reg|%rax}} %rax
Regular Expression {{Syntax highlight|regular expression|/a*b+/}} {{stx|regex|/a*b+/}} /a*b+/
Type {{Syntax highlight|type|unsigned int}} {{stx|type|unsigned int}} unsigned int