Template:Syntax highlight/doc: Difference between revisions
Jump to navigation
Jump to search
(done moving everything and nominating for deletion) |
No edit summary |
||
Line 6: | Line 6: | ||
== Usage == | == Usage == | ||
{{Code|<nowiki>{{Syntax | {{Code|<nowiki>{{Syntax highlight/category|text}}</nowiki>}} | ||
Revision as of 11:42, 27 July 2023

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.
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}}
Uses | Example | Shortcuts | Preview |
---|---|---|---|
Char/String | {{Syntax highlight/string|"Hello, World!"}} | {{stxchar|'x'}} {{stxstr|"Hello, World!"}} |
Template:Syntax highlight/string |
Comment | {{Syntax highlight/comment|//comment}} | {{stxcmnt|//comment}} | Template:Syntax highlight/comment |
Control | {{Syntax highlight/control|if}} | {{stxctrl|if}} | Template:Syntax highlight/control |
Function | {{Syntax highlight/function|main}} | {{stxfunc|main}} | Template:Syntax highlight/function |
Label | {{Syntax highlight/label|final}} | {{stxlbl|final}} | Template:Syntax highlight/label |
Macro | {{Syntax highlight/macro|#define}} | {{stxmac|#define}} | Template:Syntax highlight/macro |
Number/Operator | {{Syntax highlight/number|3.0f}} | {{stxno|3.0f}} {{stxop|+}} |
Template:Syntax highlight/number |
Register | {{Syntax highlight/register|%rax}} | {{stxreg|%rax}} | Template:Syntax highlight/register |
Regular Expression | {{Syntax highlight/regular expression|/a*b+/}} | {{stxregex|/a*b+/}} | Template:Syntax highlight/regular expression |
Type | {{Syntax highlight/type|unsigned int}} | {{stxtype|unsigned int}} | Template:Syntax highlight/type |