Template:Code/doc: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
No edit summary |
||
(40 intermediate revisions by 6 users not shown) | |||
Line 1: | Line 1: | ||
{{Doc/subpage}}__NOTOC__ | |||
This template will allow you to format text as a one-line code | This template will allow you to format text as a one-line code. | ||
== Parameters == | == Parameters and Examples == | ||
{| class= | {| class=standard-table | style="width:100%" | ||
|- | |- | ||
! Parameters | |||
! {{int:listfiles_description}} | |||
! {{int:apisandbox-examples}} | |||
! {{int:preview}} | |||
|- | |- | ||
| {{ | | align=center | {{Code|{{Param|preset}}}} | ||
| Preset Template Styles. The following presets are available: | |||
:* {{Code|preset=0|Default}} – The default style is based on Markdown; | |||
:* {{Code|preset=1|0}} – Clear version; | |||
:* {{Code|preset=1|1}} – Desaturated version; | |||
:* {{Code|preset=1|2}} – Outlined version; | |||
:* {{Code|preset=1|3}} – A brighter outlined version. | |||
| {{CodeBlock|{{Code|{{Tint|color=comment|Hello, World!}}}}}} {{CodeBlock|{{Code|{{Tint|color=yellow|preset}}={{Tint|color=green|0}}|{{Tint|color=comment|Hello, World!}}}}}} {{CodeBlock|{{Code|{{Tint|color=yellow|preset}}={{Tint|color=green|1}}|{{Tint|color=comment|Hello, World!}}}}}} {{CodeBlock|{{Code|{{Tint|color=yellow|preset}}={{Tint|color=green|2}}|{{Tint|color=comment|Hello, World!}}}}}}{{CodeBlock|{{Code|{{Tint|color=yellow|preset}}={{Tint|color=green|3}}|{{Tint|color=comment|Hello, World!}}}}}} | |||
| {{Capsule|margin=4px|{{Code|Hello, World!}}}} {{Capsule|margin=4px|{{Code|preset=0|Hello, World!}}}} {{Capsule|margin=4px|{{Code|preset=1|Hello, World!}}}} {{Capsule|margin=4px|{{Code|preset=2|Hello, World!}}}} {{Capsule|margin=4px|{{Code|preset=3|Hello, World!}}}} | |||
|- | |- | ||
| {{ | | align=center | {{Code|{{Param|select}}}} | ||
|} | | Text selection mode. Uses the {{Code|preset=1|user-select}} CSS property. Default value is {{Code|preset=1|unset}}. | ||
{| | | {{CodeBlock|{{Code|{{Tint|color=yellow|select}}={{Tint|color=green|none}}|{{Tint|color=comment|Hello, World!}}}}}} {{CodeBlock|{{Code|{{Tint|color=yellow|select}}={{Tint|color=green|all}}|{{Tint|color=comment|Hello, World!}}}}}} | ||
! | | {{Capsule|margin=4px|{{Code|select=none|Hello, World!}}}} {{Capsule|margin=4px|{{Code|select=all|Hello, World!}}}} | ||
|- | |- | ||
| {{ | | align=center | {{Code|{{Param|style}}}} | ||
| CSS styles. | |||
| {{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!}}}} | |||
|- | |- | ||
| {{ | | align=center | {{Code|{{Param|highlight}}}} | ||
| Adds syntax highlighting for the language specified. {{Bug|Condenses code into one line.}} | |||
| {{CodeBlock|margin=5px|<nowiki>{{Code|highlight=c|int main() {return 0;} }}</nowiki>}} | |||
| {{Capsule|margin=5px|{{Code|highlight=c|int main() {return 0;} }}}} | |||
|- | |- | ||
|} | |} | ||
{{Doc/Sandbox other| | |||
[[Category:Templates]] | |||
{{Doc/ | [[Category:Formatting templates]] | ||
}} | |||
[[Category: | |||
}} |
Latest revision as of 19:36, 14 August 2023

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.
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:
|
Hello, World! Hello, World! Hello, World! Hello, World! Hello, World!
| |
{{{select}}} | Text selection mode. Uses the user-select CSS property. Default value is unset. | Hello, World! Hello, World!
| |
{{{style}}} | CSS styles. | Hello, World!
| |
{{{highlight}}} | Adds syntax highlighting for the language specified. ![]() |
int main() {return 0;} |