Template:Syntax highlight: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(now that weve got syntaxhighlight supported might as well make it consistent)
(Undo revision 409895 by Pee (talk))
Tag: Undo
 
(3 intermediate revisions by the same user not shown)
Line 5: Line 5:
|comment=color: #408080;font-style: italic;
|comment=color: #408080;font-style: italic;
|control=color: #008000;font-weight: bold;
|control=color: #008000;font-weight: bold;
|function=color: #0000FF;
|function=color: #2244FF;
|label=color: #A0A000;
|label=color: #A0A000;
|macro=color: #BC7A00;
|macro=color: #BC7A00;

Latest revision as of 13:40, 23 June 2024

English (en)Deutsch (de)Esperanto (eo)Español (es)Français (fr)Suomi (fi)Hrvatski (hr)Magyar (hu)Italiano (it)日本語 (ja)한국어 (ko)Nederlands (nl)Polski (pl)Português (pt)Português do Brasil (pt-br)Русский (ru)Slovenčina (sk)Svenska (sv)Türkçe (tr)Українська (uk)Tiếng Việt (vi)中文 (zh)中文(臺灣) (zh-tw)
Curly brackets white.pngTemplate Documentation [view] [edit]
Icon-translate.png Available doc translations
View
Page history

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


Usage

{{Syntax highlight|category|text}}


Supported Categories
Uses Example Shortcuts Preview
Character/String {{syntax highlight|character|'x'}}
{{syntax highlight|string|"Hello, World!"}}
{{stx|char|'x'}}
{{stx|str|"Hello, World!"}}
'x'
Comment {{syntax highlight|comment|//comment}} {{stx|comm|//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}}
{{syntax highlight|operator|+}}
{{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