Template:Syntax highlight/doc: Difference between revisions
Jump to navigation
Jump to search
(not anymore, since we'll be changing it anyway) |
No edit summary |
||
Line 1: | Line 1: | ||
{{Doc/subpage}} | {{Doc/subpage}} | ||
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 | 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 the CSS of <nowiki><source></nowiki> if it were under the CSS <code>filter: invert(1) hue-rotate(180deg)</code>. This is what an officially endorsed wikipedia extension does to make code (which would otherwise have the same style as <nowiki><source></nowiki>) contrast against a dark mode background. The style must be calculated here, rather than be under a CSS filter because VDC software doesn't allow <code>filter</code>. | ||
Revision as of 16:09, 31 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 applies CSS to text to signify it is a certain category, such as a comment, type, string, etc. the CSS here is taken from the CSS of <source> if it were under the CSS filter: invert(1) hue-rotate(180deg)
. This is what an officially endorsed wikipedia extension does to make code (which would otherwise have the same style as <source>) contrast against a dark mode background. The style must be calculated here, rather than be under a CSS filter because VDC software doesn't allow filter
.
Usage
{{Syntax highlight|category|text}}
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 |